在ios 7中添加显示Bottom的Bar

我在我的应用程序的底部显示增加,但在iOS 7中,添加从底部显示,但在iOS 6添加显示在底部。

在这里输入图像说明

-(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坐标应该是(Y坐标在iOS 6)+20 。

您应该添加20px,因为iOS 7将状态栏视为在视图控制器中。

试试这应该工作。 根据你的答案应该是

  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 = @"********"; } 

我已经做了

 if ([[[UIDevice currentDevice] systemVersion] integerValue] < 6) { bannerView = [[GADBannerView alloc] initWithFrame:CGRectMake(128.0, 670 , GAD_SIZE_728x90.width, GAD_SIZE_728x90.height)]; bannerView.adUnitID = @"********"; } else { bannerView = [[GADBannerView alloc] initWithFrame:CGRectMake(128.0, 678 , GAD_SIZE_728x90.width, GAD_SIZE_728x90.height)]; bannerView.adUnitID = @"********"; }