2
這是一個Phonegap應用程序。我完全迷失在這裏,請幫忙。 我跟着this tutorial到了t。無廣告時隱藏iAd橫幅
這裏是我的MainViewController.m:
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
if([UIApplication sharedApplication].statusBarOrientation ==
UIInterfaceOrientationPortrait ||
[UIApplication sharedApplication].statusBarOrientation ==
UIInterfaceOrientationPortraitUpsideDown) {
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
}
else {
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
}
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
adView.frame = adFrame;
[self.view addSubview:adView];
// Black base color for background matches the native apps
theWebView.backgroundColor = [UIColor blackColor];
return [super webViewDidFinishLoad:theWebView];
}
太謝謝你了!這工作=)除了在廣告加載橫幅之前還在那裏。有任何想法嗎? – user2052886
是的,只需添加'adView.hidden = YES;'到您的原始方法,它會隱藏它,直到一個廣告加載 –
謝謝你現在完美=)你有什麼技巧來讓廣告停止重疊我的.html內容? – user2052886