Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIWebView添加子视图UIButton按钮单击事件没有响应_Ios_Objective C_Uiwebview_Uibutton - Fatal编程技术网

Ios UIWebView添加子视图UIButton按钮单击事件没有响应

Ios UIWebView添加子视图UIButton按钮单击事件没有响应,ios,objective-c,uiwebview,uibutton,Ios,Objective C,Uiwebview,Uibutton,这里,丹维尤解开了扣子 self是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"]];

这里,丹维尤解开了扣子

self是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");

}
使用

而不是

-(void)tapClick

UIWebView当然支持UIButton的addSubview,所以如果它不起作用,请检查代码。
我看到你制作了按钮的动画,移除动画并测试它的点击事件怎么样,也许你会发现问题。

谢谢,我试图取消动画,但按钮仍然无法单击谢谢,打开webView是可以的。用户交互和我删除动画,但为什么不添加动画?因为你的代码没有问题,所以我猜错误来自动画。当然,它可以添加动画,也许只是你的动画代码有一些错误。也许你必须粘贴动画代码。
-(void)tapClick