2016-07-07 52 views
0

我在admob橫幅的屏幕底部留出了大約100個高度(不知道單位)的高度,這將在項目結束時添加。我應該爲底部Admob橫幅留出多少空間?

爲iPhone 6,AdMob廣告橫幅的高度約爲100

但是,當我移動到ipad,這個高度是不同的。

所以一些元素的位置不同(高度方向)。

例如:

float admobHeight = 100.0; 

Vec2 desiredPosition = Vec2(0, 100); 

auto sprite = Sprite::create("image.png"); 
sprite->setAnchorPoint(Vec2(0, 0)); 

// Leave out space for the bottom Admob banner. 
sprite->setPosition(Vec2(desiredPosition.x, desiredPosition.y + admobHeight)); 

this->addChild(sprite); 

我設置DesignResolution爲:

(AppDelegate.cpp) 

static cocos2d::Size designResolutionSize = cocos2d::Size(768, 1136); 

和解決政策NO_BORDER:

glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); 

我怎麼能離開了高度的空間恰到好處量在我的屏幕底部爲Admob提供各種類型的設備?

+0

https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize –

+0

http://stackoverflow.com/questions/21846346/admob-with-cocos2d- V3/21859218#21859218 – Guru

回答

0

標準橫幅高度是60像素 這裏是適用於AdMob橫幅集成代碼

bannerView_ = [[ALLOC的GADBannerView] initWithFrame:方法CGRectMake(0,viewController.view.frame.size.height-60,viewController.view .frame.size.width,60)]; bannerView_.center = CGPointMake(viewController.view.frame.size.width/2.f,viewController.view.frame.size.height-30); bannerView_.adUnitID = ADMOB_BANNER_ID;

bannerView_.rootViewController=self.viewController; 

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