在 iPhone 5 之前,我可以将 admob 横幅放在屏幕底部(就在标签栏上方)。但由于 iPhone 5 的屏幕尺寸,现在一切都受到了干扰。我什至尝试通过自动布局来做到这一点(它没有用)。我怎样才能为两种屏幕尺寸做到这一点?
这是我的代码 -
-(void) viewDidLoad {
[super viewDidLoad];
adMob = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0,
367.0 -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
adMob.translatesAutoresizingMaskIntoConstraints=NO;
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
adMob.adUnitID = @"XXXXXXXX";
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
adMob.rootViewController = self;
GADRequest *request = [GADRequest request];
request.testing=YES;
[self.view addSubview:adMob];
// Initiate a generic request to load it with an ad.
[adMob loadRequest:[GADRequest request]];
[adMob release];
// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
}
任何帮助,将不胜感激!