我的AdMob的横幅显示在顶部我的、横幅、AdMob

2023-09-09 22:02:18 作者:干掉上帝我称王

我在我的应用程序中的AdMob的旗帜,我已经与所提供的文件AdMob的实现了它,唯一错的是,它并没有在屏幕的底部,但在顶部,而不是显示。现在,我已经找了很长时间,但我无法找到如何改变它,我找不到任何一个网解决这个问题。

I have a admob banner in my app and I've implemented it with the documentation AdMob provided, the only thing wrong with it is that it does not show at the bottom of the screen but in the top instead. Now I've been looking for a long time But I can't find how to change it and I can't find anyone one the net solving this problem.

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

Someone knows how to fix this?

感谢

修改

// 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的电话号码,但找不到任何修改。

been looking for numbers on all the admob scripts but Can't find any to edit..

推荐答案

你有没有试图改变视图的框架(GADBannerView怎么想吗?)在底部而非顶部位置呢?

Have you tried changing the frame of the view (GADBannerView I think?) to position it at the bottom instead of the top?

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

Here's an example (you should replace the placeholders with the correct attributes: 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 + 20 -
                               CGSizeFromGADAdSize(kGADAdSizeBanner).height);

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