我们正尝试使用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;
}
Run Code Online (Sandbox Code Playgroud)
下面是集成和运行后在单视图应用程序中显示的屏幕截图.一旦我点击按钮,它就不会被点击.