我有一个 spritekit
我想要的项目iAd
出现在屏幕底部。我用了storyboard
至position
它在屏幕的底部。唯一的问题是如果我把它放在 iPhone 4
的底部。屏幕它最终出现在 iPhone 5
的中间, 如果我把它放在 iPhone 5
的底部屏幕上它没有出现在 4 上。我通过使用 banner.Center
修复了这个问题一段时间。但是当我改变 views
banner
不会重新加载,因此它不会出现在 iPhone 4
上屏幕。
#pragma mark iAd Delegate Methods
-(void)bannerViewDidLoadAd:(ADBannerView *)banner{
NSLog(@"SUCCESS");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
if (device == 4) {
banner.center = CGPointMake(160, 455);
}
if (device == 5) {
banner.center = CGPointMake(160, 543);
}
adIsThere = YES;
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{
NSLog(@"ERROR");
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
adIsThere = NO;
}
我找到了这个链接,但是当我点击
storyboard
上的广告时在尺寸检查器上,autosizing
部分没有出现....我认为这与它是 SpriteKit
的事实有关。 project
.iad iPhone 5 Storyboard implementation
如果你能帮忙,谢谢!
最佳答案
也许不是用确切的数字设置位置,而是将其设置为屏幕底部减去横幅广告的大小。
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
banner.center = CGPointMake(160, screenHeight - bannerView_.frame.size.height);
编辑:如果您使用 Storyboard ,也许您可以尝试使用约束,右键单击从 iAd 横幅拖动到“ View ”并选择“底部空间到底部布局指南”
关于ios - iphone 5 和 iphone 4 问题上的 iAd 定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25635948/