I'm trying to get my Admob ad to adjust between all the different iPhone screen sizes that Apple offers, but I can't figure out how to get it to adjust automatically or by using different code.
In my viewdidload
bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0, 430, 320, 50)];
bannerView_.adUnitID = @"";
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
GADRequest *request = [GADRequest request];
request.testDevices = [NSArray arrayWithObjects:@"", nil ];
You need to set the
adSizeproperty to Google's set banner sizekGADAdSizeBanner. Then you set yourGADBannerView'sframerelative to theview. The following code places theGADBannerViewon the bottom of yourview.x- Set to origin of0y- Set origin to theview's height. But this will make it appear off the bottom of the screen. So, we must subtract the height of ourGADBannerViewto move it up onto the screen:self.view.frame.size.height - admobBannerView.frame.size.heightwidth- Set it to the width of theview:self.view.frame.size.widthheight- Set it to the height of ourGADBannerView:admobBannerView.frame.size.heightBanner Ad Customization