2011-12-13 56 views
1

我的iOS应用中有插页式全屏广告。我无法控制广告的HTML代码。我不希望修改广告网络提供的广告代码。 由于网络问题,有时广告未被加载。 没有办法关闭利益。此后应用程序无法使用。将UIButton放在全屏UIWebView上以在UIWebView无法加载时关闭它

我希望将本机关闭UIButton放在UIWebView上。 我不使用IB,我必须以编程方式制作这样的按钮。

如何做到这一点?

回答

3

例如,

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
[button addTarget:self 
      action:@selector(closeAd:) 
forControlEvents:UIControlEventTouchUpInside]; 
[button setTitle:@"Close" forState:UIControlStateNormal]; 
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0); 
[view addSubview:button]; 

然后把你方法

-(void)closeAd:(id)sender; 
+0

喜欢的任何代码,但我将如何保证,这将是高于一个UIWebView的方式相同,但的3rdParty模块产生的?有没有像HTML中的z-index或Delphi中的TopMost属性。 – Max 2011-12-14 11:36:58