2013-06-25 86 views
3

我已將橫幅尺寸設置爲320 * 50。對於Retina顯示器,我已將它設置爲640 * 100。它根本不顯示橫幅。你能讓我知道我犯了什麼錯誤嗎?它適用於大小爲320 * 50,但不是640 * 100時。用於視網膜顯示的AdMob橫幅尺寸iphone

回答

3

在視網膜設備上也使用320x50。廣告網絡有責任以2倍密度的圖像回來以適應您的設備,而不是您的框架的兩倍。

5

是的,你在Retina設備上使用相同的尺寸。

但是,您不應該設置具體的大小。如果您決定將您的應用轉換爲iPad,那麼您的廣告代碼將突然停止工作,因爲它只會在屏幕上延伸一半。

使用智能橫幅尺寸,Admob將爲您全力以赴。例如,下面是我的一個應用程序的一些代碼,它將橫幅放在屏幕的底部。特別要注意使用kGADAdSizeSmartBannerPortrait,這可以調整廣告橫幅的大小。

//Admob 

// Available AdSize constants are explained in GADAdSize.h. 
GADBannerView *bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait]; 
bannerView_.rootViewController = self; 
bannerView_.adUnitID = @"ca-app-pub-xxxxxxxxx/xxxx"; 

// Position the ad at the bottom of screen. 
// By default it would be postitioned at (0,0) 
bannerView_.frame = CGRectMake(0, 
           self.view.frame.size.height - bannerView_.frame.size.height, 
           bannerView_.frame.size.width, 
           bannerView_.frame.size.height); 

bannerView_.autoresizingMask = 
UIViewAutoresizingFlexibleLeftMargin | 
UIViewAutoresizingFlexibleTopMargin | 
UIViewAutoresizingFlexibleWidth | 
UIViewAutoresizingFlexibleRightMargin; 

[self.view addSubview:bannerView_]; 

// Initiate a generic request to load it with an ad. 
GADRequest *request = [GADRequest request]; 
request.testDevices = [NSArray arrayWithObjects: 
         GAD_SIMULATOR_ID, 
         nil]; 
[bannerView_ loadRequest:request];