iOS button addTarget 无法响应事件
1.问题描述
封装了一个XYAlterview,继承于UIView,但button addTarget 无法响应事件.
2.问题重现
@interface XYAlertView : UIView
@end
XYAlterView的实现结构是:bgView ,alertBgView,button
` - (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if(self){
[self addSubview:bgView];
[bgview addSubview: alertBgView]
[button addTarget:self
action:@selector(buttonBeCick:)
forControlEvents:
UIControlEventTouchUpInside];
[alertBgView addSubview :button]
}
return self;
}
-(void)showAlertViewinSuperView:(UIView *)superView{
[superView