iphone - 如何在 iOS 视网膜和非视网膜屏幕底部放置 admob 横幅

标签 iphone ios objective-c cordova

我构建了一个 phonegap 应用程序,并想向其添加 Admob 横幅。我的横幅在 iOS6 模拟器的屏幕底部工作,但是当我在视网膜设备上测试它时,横幅将远离底部,就像它仍在尝试为非视网膜显示器调整屏幕大小一样。这是我当前在 viewDidLoad 中的代码:

// Initialize the banner at the bottom of the screen.
CGPoint origin = CGPointMake(0.0,
                             self.view.frame.size.height -
                             CGSizeFromGADAdSize(kGADAdSizeBanner).height);

// Use predefined GADAdSize constants to define the GADBannerView.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
                                             origin:origin];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"xxxxxxxxxxxx";

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];

最佳答案

你可以试试这个,

bannerView_ = [[GADBannerView alloc] initWithFrame:CGRectMake(0.0, self.view.frame.size.height-GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)];

关于iphone - 如何在 iOS 视网膜和非视网膜屏幕底部放置 admob 横幅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14564033/

相关文章:

iphone - 如何在 ios 6 的 map 上绘制路线?

ios - 从没有委托(delegate) iOS7 的 UIViewController 返回一个 NSString

ios - iOS 应用中的谷歌地图 RouteBoxer

ios - 用 isEqual 比较字符串没有运行完整的功能 iOS

ios - 这种情况下Tableview的reloadData是否立即执行

ios - 插入图像后 NSAttributedString 意外更改字体

ios - mainRunloop 上的 NSURLConnection 不工作

ios - 要检查wifi是否开启但没有互联网连接

ios - 根据相应表格单元格文本字段的更改更新表格 View 单元格的 subview

iphone - Xcode 和 admob 第一次做什么?