在ios 7中添加显示底部窗体的栏 [英] Adds Bar showing up form Bottom in ios 7
问题描述
我在我的应用程序底部显示添加,但在iOS 7中,添加从底部显示,但在iOS 6添加显示在底部。
I am showing adds at the bottom of my app, but in iOS 7, adds are showing up from the bottom, but in iOS 6 adds are showing at the bottom.
-(void)showAdds
{
[bannerView removeFromSuperview];
if ((UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad))
{
// bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(128.0,
670 ,
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
bannerView.adUnitID = @"********";
}
else {
// Create a view of the standard size at the bottom of the screen.
// bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(80,
250,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
bannerView.adUnitID = @"*******";
NSLog(@"ads");
}
bannerView.rootViewController = self;
[self.view addSubview:bannerView];
// Initiate a generic request to load it with an ad.
[bannerView loadRequest:[GADRequest request]];
}
推荐答案
如果你以编程方式进行操作然后首先需要为iOS 6设置baneerview的正确位置,然后检测其iOS 6或iOs 7是否为iOS 7,然后其Y坐标应为(在iOS 6中为Y坐标)+ 20。
If you are doing it Programmatically Then you first need to set up the correct position of baneerview for iOS 6, then detect if its iOS 6 Or iOs 7 if its iOS 7 then its Y coordinate should be (Y coordinate In iOS 6) +20.
您应该添加20px,因为iOS 7将状态栏视为视图控制器内部。
You should add 20px because iOS 7 takes the status bar as inside the view controller.
试试这个应该有效。
根据你的答案,它应该是
Try this it should work. According to your answer it should be
if ([[[UIDevice currentDevice] systemVersion] integerValue] < 7)
{
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(128.0,
670 ,// Replace it with 650
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
bannerView.adUnitID = @"********";
}
else
{
bannerView = [[GADBannerView alloc]
initWithFrame:CGRectMake(128.0,
690 ,// Replace it with 670 if upper value is replaced with 650
GAD_SIZE_728x90.width,
GAD_SIZE_728x90.height)];
bannerView.adUnitID = @"********";
}
这篇关于在ios 7中添加显示底部窗体的栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!