2016-07-07 92 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]];