Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios iAd涵盖phonegap中的应用程序内容?_Ios_Objective C_Cordova_Iad - Fatal编程技术网

Ios iAd涵盖phonegap中的应用程序内容?

Ios iAd涵盖phonegap中的应用程序内容?,ios,objective-c,cordova,iad,Ios,Objective C,Cordova,Iad,我在我的webViewDidFinishLoad中有这个: - (void)setupAdBanner { adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; CGRect adFrame = adView.frame; if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait

我在我的
webViewDidFinishLoad
中有这个:

- (void)setupAdBanner {
    adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    CGRect adFrame = adView.frame;
    if([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait
       || [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown) {
        adView.currentContentSizeIdentifier =
        ADBannerContentSizeIdentifierPortrait;
        adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
    } else {
        adView.currentContentSizeIdentifier =
        ADBannerContentSizeIdentifierLandscape;
        adFrame.size.width = adView.frame.size.width;
        adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
    }
    adView.frame = adFrame;

    [self.view addSubview:adView];
}

这与我的phonegap应用程序中的HTML内容重叠。如何调整我的webview框架大小以适应广告横幅?

我遇到了这个问题。我在这里写了我的解决方案

您需要实现ADBannerViewDelegateProtocolReference。在MainViewController.h中:

@interface MainViewController : CDVViewController <ADBannerViewDelegate> 
{
    ADBannerView *adView;
}
@end
添加以下两种方法:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{
    CGRect resizedWebView = [super webView].frame;
    resizedWebView.size.height = adView.frame.origin.y;
    [super webView].frame = resizedWebView;
    [self.view bringSubviewToFront:adView];
    adView.hidden = NO;
} 

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    CGRect resizedWebView = [super webView].frame;
    resizedWebView.size.height = self.view.frame.size.height;
    [super webView].frame = resizedWebView;
    adView.hidden = YES;
}
神奇的是
[self.view将subview带到front:adView]

我遇到了这个问题。我在这里写了我的解决方案

您需要实现ADBannerViewDelegateProtocolReference。在MainViewController.h中:

@interface MainViewController : CDVViewController <ADBannerViewDelegate> 
{
    ADBannerView *adView;
}
@end
添加以下两种方法:

- (void)bannerViewDidLoadAd:(ADBannerView *)banner 
{
    CGRect resizedWebView = [super webView].frame;
    resizedWebView.size.height = adView.frame.origin.y;
    [super webView].frame = resizedWebView;
    [self.view bringSubviewToFront:adView];
    adView.hidden = NO;
} 

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    CGRect resizedWebView = [super webView].frame;
    resizedWebView.size.height = self.view.frame.size.height;
    [super webView].frame = resizedWebView;
    adView.hidden = YES;
}
神奇的是
[self.view将subview带到front:adView]