Andyrewwer
Andyrewwer

Reputation: 64

iAd Banner not working

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 :)

Upvotes: 0

Views: 409

Answers (1)

MasterRazer
MasterRazer

Reputation: 1377

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.

Upvotes: 1

Related Questions