[英]UIWebView addSubView UIButton The button click event is not responding
Here _danView is Unbutton 在这里_danView取消按钮
and self is UIWebView 而自我是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 surely support addSubview for UIButton, so if it doesn't work, check the code. UIWebView肯定支持UIButton的addSubview,因此,如果不起作用,请检查代码。
I see you animate the button, how about remove the animation and test its click event, maybe you will find something the matter. 我看到您为按钮设置了动画,如何删除动画并测试其单击事件,也许您会发现一些问题。
use 采用
- (IBAction)tapClick:(id)sender
instead of 代替
-(void)tapClick
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.