2
我正在使用AdMob並將GADBannerView加載到UITableViewController而不是通用的UIView中。任何人都可以告訴我如何加載橫幅,並只出現在表視圖的頂部?下面是代碼:在UITableViewController中加載GADBannerView
在nameViewController.h文件:
@interface nameViewController : UITableViewController {
GADBannerView *AbMob;
}
在上(無效)viewDidLoad中的nameViewController.m文件:
//AdMob block
AbMob = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
self.view.frame.size.height -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
AbMob.adUnitID = AdMob_ID;
AbMob.rootViewController = self;
[self.view addSubview:AbMob];
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[AbMob loadRequest:r];
任何想法,將不勝感激,右現在它只是漂浮在那裏。
是否真的沒有建議的方式來處理UITableViewController中的這個問題,就像OP詢問的那樣?你鏈接的例子使用UIViewController,但大多數簡單的表視圖使用UITableViewController,所以你不需要連接表視圖,數據源和委託自己。當然,我可以經歷將我的UITableViewControllers轉換爲常規UIViewControllers的麻煩,但我寧願不要,我懷疑我並不孤單。 – 2014-03-29 06:59:53
404.這是一個錯誤。 – SpyZip 2016-03-31 09:08:31