6

アプリに 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スクリプトで番号を探していましたが、編集するものが見つかりません..

4

3 に答える 3

15

ビューのフレーム (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];
于 2012-07-01T23:08:39.707 に答える
2
CGFloat height = [UIScreen mainScreen].bounds.size.height;

bannerView_=[[GADBannerView alloc] initWithAdSize:(kGADAdSizeBanner) origin:CGPointMake(0,height-kGADAdSizeBanner.size.height)];
于 2014-04-25T09:27:33.047 に答える