2016-03-25 91 views
0

这里_danView是解开UIWebView的addSubView UIButton的按钮点击事件没有响应

和自我是一个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"); 

} 

回答

-2

- (IBAction)tapClick:(id)sender 

代替

-(void)tapClick 
+0

谢谢!但按钮不是用XIB创建的 –

+0

这不是问题你还是可以做到的.. –

0

的UIWebView当然是支持UIButton的addSubview,所以如果它不起作用,请检查代码。
我看到你动画的按钮,如何删除动画和测试其点击事件,也许你会发现一些事情。

+0

谢谢,我试图取消动画,但按钮仍然不能点击 –

+0

谢谢,可以打开webView.user交互,我删除动画 –

+0

但是为什么不添加动画? –