objective-c - 我的 admob 横幅显示在顶部

标签 objective-c ios admob

我的应用程序中有一个 admob 横幅,我已经使用 AdMob 提供的文档实现了它,唯一的问题是它没有显示在屏幕底部,而是显示在顶部。现在我已经找了很长时间但是我找不到如何改变它而且我找不到任何人在网上解决这个问题。

有人知道如何解决这个问题吗?

谢谢

编辑

// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = @"MYID";    
// 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]];

一直在寻找所有 admob 脚本中的数字,但找不到要编辑的任何数字..

最佳答案

您是否尝试过更改 View 的框架(我认为是 GADBannerView?)以将其定位在底部而不是顶部?

这是一个示例(您应该用正确的属性替换占位符: bannerView.frame = CGRectMake(0.0, 460 - bannerheight, bannerwidth, bannerheight);


编辑:

您需要做的就是替换它:

bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

所有这些:

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

关于objective-c - 我的 admob 横幅显示在顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11286301/

相关文章:

ios - 为什么要添加Animation :forKey not working in viewDidLoaded

objective-c - Xcode 5 无法启动应用程序,错误为 : failed to launch '/path/to/.app' -- Busy

ios - 如何禁用iphone中的相机切换按钮

android - 当 Android 应用程序仅以 alpha 版发布时,有没有办法将其链接到 Admob?

ios - Apple TV 强制聚焦另一个 View

objective-c - swift 1.2 : Implement optional property from Objc protocol

iphone - 在 UINavigationbar 中添加无边框搜索按钮

ios - iCarousel 间距不平滑

ios - 无法从 View 中删除 Admob 横幅 (iOS)

android - 如何通过应用内结算隐藏或删除广告