简体   繁体   English

如何在使用canDisplayBannerAds的iOS7应用中将iAd移动到屏幕顶部?

[英]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 . 通过使用canDisplayBannerAds ,将iAd添加到iOS7应用似乎很简单。 Basically I add the iAd framework, import the header and then in the view controller do this: 基本上,我添加iAd框架,导入标头,然后在视图控制器中执行以下操作:

- (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. 当iAd确实显示时,它正确位于屏幕底部。

However how do I move the iAd to the top of the screen instead? 但是,如何将iAd移至屏幕顶部?

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. 我的游戏应用程序在屏幕底部有几个按钮,苹果公司建议的准则是通过将iAd移动到屏幕的另一个区域来避免意外点击iAd。 But then I can't find any info on how to move this iAd. 但是后来我找不到有关如何移动此iAd的任何信息。

(I'm totally new to iAds and was hoping for minimal code changes by using canDisplayBannerAds so any suggestions greatly appreciated). (我是iAd的新手,并希望使用canDisplayBannerAds进行最少的代码更改,因此,任何建议都将不胜感激)。

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. 我现在只是在设置iAd ,还需要在屏幕上移动ADBannerView

-(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. 再说一次,这就是我所做的,对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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