我努力让iAdBanner出现在屏幕的顶部而不是底部。在故事板中,我将AdBanner放在顶部但是当应用程序加载时它仍然出现在屏幕的底部,但是,当我单击广告然后退出它时,iAdBanner会按预期移动到屏幕顶部。任何有关将其默认位置设置到屏幕顶部的帮助表示赞赏。
以下是我目前用于触发添加的代码。
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
NSLog(@"Ad Displayed");
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
NSLog(@"Ad Failed To Display");
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Configure the view.
SKView * skView = (SKView *)self.view;
skView.showsFPS = YES;
skView.showsNodeCount = YES;
// Create and configure the scene.
SKScene * scene = [AlienGravityGame sceneWithSize:skView.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
// Present the scene.
[skView presentScene:scene];
self.canDisplayBannerAds = YES;
}