2013-03-30 150 views
0

我想知道什麼是最佳做法以及如何在屏幕底部顯示廣告橫幅。我正在使用phonegap 2.5,我可以將它顯示在屏幕的頂部。這就是我創建adBannerView的方式。iOS iAd橫幅廣告放置

- (void)webViewDidFinishLoad:(UIWebView*)theWebView 
{ 
    // Black base color for background matches the native apps 
    theWebView.backgroundColor = [UIColor blackColor]; 

    adView = [[[ADBannerView alloc] initWithFrame:CGRectZero] autorelease]; 
    //adView.frame = CGRectMake(0, 410, 320, 50); // if you want the banner to be on top of the screen remove this line 
    adView.delegate = self; 
    adView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 
    [theWebView addSubview:adView]; 

    return [super webViewDidFinishLoad:theWebView]; 
} 

我不知道如果我想修復基於註釋掉排隊上面,因爲iPhone手機(4,5)具有不同的分辨率的位置。請讓我知道如何將它放置在屏幕的底部。

謝謝。

我試了一下在這link,但我得到關於衝突的約束

回答

1

試試這個錯誤!

adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; 
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait]; 
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait; 
CGRect adFrame = adView.frame; 
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height; 
adView.frame = adFrame; 
[theWebView addSubview:adView]; 
+0

它沒有工作。 –

+0

我最終在xib文件中添加了橫幅,並將該屬性用作出口。不知何故,它在肖像模式和底部工作,無法使其在橫向工作。但是現在對我來說已經夠好了。 –