我的admob横幅显示在顶部

时间:2012-07-01 23:05:52

标签: 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脚本上的数字,但找不到任何编辑..

3 个答案:

答案 0 :(得分:15)

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

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


修改

您需要做的就是替换它:

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

答案 1 :(得分:2)

CGFloat height = [UIScreen mainScreen].bounds.size.height;

bannerView_=[[GADBannerView alloc] initWithAdSize:(kGADAdSizeBanner) origin:CGPointMake(0,height-kGADAdSizeBanner.size.height)];

答案 2 :(得分:0)

if(isset($_POST['txtspecificaddress']))
{   
    $specificaddress = trim($_POST['txtspecificaddress']);
}
echo $specificaddress;

这适用于所有iphone和iPad