简体   繁体   中英

How move an iAd to top of screen in an iOS7 app that uses canDisplayBannerAds?

It seems that adding an iAd to an iOS7 app is straightforward by using canDisplayBannerAds . Basically I add the iAd framework, import the header and then in the view controller do this:

- (void)awakeFromNib
{
    self.canDisplayBannerAds = YES;
    [super awakeFromNib];
}

This seems to work fine in the simulator (though ads frequently don't seem to show up). When an iAd does show up it is correctly at the bottom of the screen.

However how do I move the iAd to the top of the screen instead?

My game app has a few buttons at the bottom of the screen and the guidelines Apple suggests are to avoid accidental clicking of the iAd by moving the iAd to another area of the screen. But then I can't find any info on how to move this iAd.

(I'm totally new to iAds and was hoping for minimal code changes by using canDisplayBannerAds so any suggestions greatly appreciated).

I am not sure if this is what you are looking for. I think I read the question correct. I am just setting my iAd up now, and I also needed to move the ADBannerView on the screen.

-(void)bannerViewDidLoadAd:(ADBannerView *)banner{    

    [UIView beginAnimations:nil context:nil];    
    [UIView setAnimationDuration:1];    
    [banner setAlpha:1];    
    [UIView commitAnimations];    

    banner.frame = CGRectMake(0,518,320,50);    
}

Again, this is just what I did and it works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM