ios – UIButton从静态库触发时单击“不工作”
发布时间:2020-12-14 19:20:46 所属栏目:百科 来源:网络整理
导读:我们正尝试使用webview从静态库项目触发显示按钮.在将静态库与单视图应用程序集成时,我们得到了输出设计.但是当我们尝试通过点击按钮尝试操作时它不起作用. 下面是我们在cocoa touch静态库中使用的代码 UIButton *imageButton = [UIButton buttonWithType:UI
我们正尝试使用webview从静态库项目触发显示按钮.在将静态库与单视图应用程序集成时,我们得到了输出设计.但是当我们尝试通过点击按钮尝试操作时它不起作用.
下面是我们在cocoa touch静态库中使用的代码 UIButton *imageButton = [UIButton buttonWithType:UIButtonTypeCustom]; imageButton.frame = CGRectMake(self.view.frame.size.width-50,10,50,50); [imageButton setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal]; imageButton.adjustsImageWhenHighlighted = NO; // [imageButton addTarget:self action:@selector(close:) forControlEvents:UIControlEventTouchUpInside]; [imageButton addTarget:self action:@selector(hideWebViewBtn:) forControlEvents:UIControlEventTouchUpInside]; -(IBAction)hideWebViewBtn:(id)sender { NSLog(@"Hide Button clicked"); [self.adView removeFromSuperview]; self.adView = nil; return; } 下面是集成和运行后在单视图应用程序中显示的屏幕截图. 解决方法
尝试这个,无论是自我按钮是否触发..
[self.myButton sendActionsForControlEvents:UIControlEventTouchUpInside]; 它对我有用 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |