2013-05-15 18 views
1

我正在一個應用程序的電話差距,所以我只處理web視圖。在這個應用程序,我需要把廣告放在屏幕的底部。我正在使用谷歌admob這個。這會生成浮動廣告窗口。我把這個窗口放在屏幕的底部,但問題是我的webview內容隱藏在這個窗口的後面。谷歌admob不可點擊裏面的矩形

因此,我製作了一個矩形,並在此矩形中添加了此Google admob窗口。它解決了我的數據隱藏問題,但現在它不能點擊。

我的代碼:

- (void)webViewDidFinishLoad:(UIWebView*)theWebView 
{ 

    theWebView.backgroundColor = [UIColor blackColor]; 


    CGRect viewBounds = CGRectMake([[UIScreen mainScreen] applicationFrame].origin.x, [[UIScreen mainScreen] applicationFrame].origin.y, [[UIScreen mainScreen] applicationFrame].size.width, [[UIScreen mainScreen] applicationFrame].size.height-CGSizeFromGADAdSize(kGADAdSizeBanner).height); 
    self.view.frame = viewBounds; 


    CGPoint origin = CGPointMake(0.0,theWebView.frame.size.height); 

    bannerView_ = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner origin:origin] autorelease]; 

    bannerView_.adUnitID = @"___ADMOBID___"; 
    bannerView_.rootViewController = self; 
    [self.view addSubview:bannerView_]; 


    [bannerView_ loadRequest:[GADRequest request]]; 

    return [super webViewDidFinishLoad:theWebView]; 
} 

如何使矩形(的CGRect)在AdMob點擊???

在此先感謝...

回答

0

你實際上使得主視圖較小,基本上 - 我猜 - 重新調整其內容(包括web視圖然後你把橫幅畫面右側的網頁視圖下,但它會出現反正你最有可能在你的主視圖中將clipsToBounds標誌設置爲NO

你需要做的是使webview(而不是主視圖)使用CGRectGetHeight(self.view.bounds) - CGRectGetHeight(kGADAdSizeBanner)(而不是應用程序框架),然後將它們放在相應的位置。

檢查self.view.clipsToBounds標誌並將其設置爲YES,無論是在代碼中還是在IB中,爲了測試正確的行爲,屏幕上看不到的內容都不會觸及。

+0

我在哪裏添加上面的代碼?... – KiShOrE