iAd Banner not working

情到浓时终转凉″ 提交于 2019-12-13 06:59:17

问题


SO I used a tutorial to create an iAd Banner at the bottom of the screen and animate it into and out of the window, however the app is a tab based, and i do not quite know the correct offset, so you could tell me I would appreciate it, however the primary problem, is that the adBanner does not always appear, and when it does sometimes it is just a white box. Here is my code. In my .h

@interface section3 <ADBannerViewDelegate>{
    ADBannerView *adView;
    BOOL bannerIsVisible;
}
@property (nonatomic, assign) BOOL bannerIsVisible;
//in the .m     in the view did load

adView  = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.frame = CGRectOffset(adView.frame, 0.0, 410.0f);
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
[self.view addSubview:adView];
adView.delegate = self;
self.bannerIsVisible = NO; 
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{

    if (!self.bannerIsVisible) {
        [UIView beginAnimations:@"animateAdBannerOn" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0.0, -50.0f);
        [UIView commitAnimations];
        self.bannerIsVisible = YES;

    }
}

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{

    if (self.bannerIsVisible) {
        [UIView beginAnimations:@"animateAdBannerOff" context:NULL];
        banner.frame = CGRectOffset(banner.frame, 0.0, 50.0f);
        [UIView commitAnimations];
        self.bannerIsVisible = NO;

    }

}

I am using Xcode 4.2.1 Thank you very much, any help would be appreciated :)


回答1:


The tabbar is 44px high so u must add to one of the "50" 44 and make 410 to the full screen size of 3.5 inch means to 480 default. That should be the solution.



来源:https://stackoverflow.com/questions/13103315/iad-banner-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!