Ios 无法单击添加到Phonegap应用程序的iAd横幅,但有轻微偏移
所以我大致上遵循了关于如何使iAd横幅不覆盖Phonegap应用程序的教程,但不得不即兴创作,因为它并没有真正起作用。因此,在我的Ios 无法单击添加到Phonegap应用程序的iAd横幅,但有轻微偏移,ios,cordova,iad,Ios,Cordova,Iad,所以我大致上遵循了关于如何使iAd横幅不覆盖Phonegap应用程序的教程,但不得不即兴创作,因为它并没有真正起作用。因此,在我的webViewDidFinishLoad中,在我的mainViewController方法中,我有: - (void)webViewDidFinishLoad:(UIWebView*)theWebView { adView.frame = CGRectOffset(adView.frame, 0, [[UIScreen mainScreen] bounds].
webViewDidFinishLoad
中,在我的mainViewController
方法中,我有:
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
adView.frame = CGRectOffset(adView.frame, 0, [[UIScreen mainScreen] bounds].size.height - 70);
adView.delegate = self;
[adView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
[theWebView addSubview:adView];
[self.view bringSubviewToFront:adView];
return [ super webViewDidFinishLoad:theWebView ];
}
adView
已正确初始化并正常运行。打破这一点(如我不能点击横幅)的是视图中的此代码将出现
:
- (void)viewWillAppear:(BOOL)animated
{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = 20;
viewBounds.size.height = viewBounds.size.height - 70;
self.webView.frame = viewBounds;
}
[super viewWillAppear:animated];
}
我添加了70px偏移量,以使横幅不覆盖内容。现在,如果我删除这个代码,我可以点击横幅罚款。怎么了?我真傻。我将子视图添加到
webview
,而不是self.view
,这使得它超出了它的边界,不可访问