view.h
#import <UIKit/UIKit.h>
@interface view : UIView
@end
view.m
#import "view.h"
#import "TestBtn.h"
@implementation view
{
TestBtn *btn;
}
-(instancetype)initWithFrame:(CGRect)frame
{
self.userInteractionEnabled = YES;
self = [super initWithFrame:frame];
if (self) {
//这里不给btn设置frame,是防止点击view内部时,btn也进行响应