我正在一个IOS应用程序是这样的结构:AdMob的横幅位置
主导航(对于mainapp登录导航控制器) - > tabBarController(3选项卡栏项) - > NavigationController(导航contronoller为每个标签栏项目)。
我想添加admob在我的应用程序的顶部(在我的导航栏的顶部...)。 在我的标签栏项目的viewDidLoad中,我这样做:
- (void)viewDidLoad
{
[super viewDidLoad];
//bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
70.0 -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
// Specify the ad's "unit identifier". This is your AdMob Publisher ID.
bannerView_.adUnitID = @"ID";
bannerView_.rootViewController = self;
[self.navigationController.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
}
旗帜,隐藏导航栏,就像这样:http://cl.ly/image/3C2S0m040O2h 相反,如果我不使用:
bannerView_ = [[GADBannerView alloc]
initWithFrame:CGRectMake(0.0,
70.0 -
GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height)];
但用途:
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
如此看来:http://cl.ly/image/203v1C2W1b2P 相反我想,横幅显示在顶部,所有内容(也是导航栏)...去横幅下面。 我该怎么办? 谢谢,对不起我的英文不好。
没有其他soluton或解决方法吗?例如我有应用程序委托中的mainNavigation,这是隐藏的......也许我可以使用它? –
我尝试过: 'code' AppDelegate * appDelegate =(AppDelegate *)[[UIApplication sharedApplication] delegate]; appDelegate.mainNavController.navigationBarHidden = NO; [appDelegate.mainNavController.view addSubview:bannerView_]; –
它看起来是这样的:http://cl.ly/image/2g2R28242Q2w –