[英]UIWebView addSubView UIButton The button click event is not responding
在這里_danView取消按鈕
而自我是UIWebView
_danView.frame = CGRectMake(windowWidth +randWindth, gaodu+[heiArr[i]intValue], size.width+40+(size.height+8)/2, size.height+8);
_danView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"danmaku_bg"]];
_danView.userInteractionEnabled = YES;
self.userInteractionEnabled = YES;
[_danView addTarget:self action:@selector(tapClick) forControlEvents:UIControlEventTouchUpInside];
_danView.layer.cornerRadius = (size.height+8)/2;
_danView.layer.masksToBounds = YES;
[self addSubview:_danView];
// [_danView addSubview:label];
[self animationWithView:_danView];
-(void)tapClick{
NSLog(@"click click");
}
UIWebView肯定支持UIButton的addSubview,因此,如果不起作用,請檢查代碼。
我看到您為按鈕設置了動畫,如何刪除動畫並測試其單擊事件,也許您會發現一些問題。
采用
- (IBAction)tapClick:(id)sender
代替
-(void)tapClick
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.