1

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.

enter image description here

-(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]];

}
user unknown
  • 35,537
  • 11
  • 75
  • 121
Pravin
  • 44
  • 9
  • just edit your question and in the box where you edit the text Press command+D and choose your screenshot or there is options just below Title choose image from there –  Oct 22 '13 at 05:49
  • are you creating banner in Interface builder Or Programettically ? –  Oct 22 '13 at 05:58

2 Answers2

3

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.

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 = @"********";
    }
Apostolos
  • 10,033
  • 5
  • 24
  • 39
0

I have done it

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


}
Kalpesh
  • 5,336
  • 26
  • 41
Pravin
  • 44
  • 9
  • your condition is wrong . if ios version is 6 then else part will be executed.. i think else part is for ios 7 .. – Kalpesh Oct 22 '13 at 06:26