.h
#import <UIKit/UIKit.h>
@interface UIButton (Wave)
/* 设置显示水波纹效果 */
@property(nonatomic,assign)BOOL isShowWave;
@end
.m
#import "UIButton+Wave.h"
#import <objc/runtime.h>
@interface UIButton ()
/* 波纹视图 */
@property(nonatomic,strong) UIView *waveView;
@end
@implementation UIButton (Wave)
static const char *waveViewId = "waveView";
static const char *showWave = "showWave";
+ (void)load
{
SwizzleMethod(self, @selector(initWithFrame:), @selector(mk_initWithFrame:));
SwizzleMethod(self, @selector(setFrame:), @selector(mk_setFrame:));
SwizzleMethod(self, @selector(beginTrackingWithTouch:withEvent:), @selector(mk_beginTrackingWithTouch:withEvent:));
}
<