问题描述
我有previously试穿TabbarView基于应用程序中显示Admobs广告。但是,当我试图实现在一个UIWebView的应用程序的东西一样似乎并没有工作的权利。
I have previously tried displaying Admobs ads on TabbarView based application. But when I try to implement the same on a UIWebView based application things don't seem to work right.
我想里面添加的code - (无效)viewDidLoad中
但应用程序崩溃。
I tried to add the code inside -(void)viewDidLoad
but the application crashed.
我用我的应用程序内的方法包括:
The methods i'm using inside my application include:
-
(无效)viewDidAppear:(BOOL)动画
-
(无效)viewDidDisappear:(BOOL)动画
-
(无效)装载
(void) viewDidAppear:(BOOL)animated
(void) viewDidDisappear:(BOOL)animated
(void) loading
在哪里执行它,以查看我的应用程序?
Where should I implement it to view in my application?
任何帮助将是AP preciated。
Any help would be appreciated.
推荐答案
您可以在应用程序的末尾添加AdMob的横幅,以窗口:didFinishLaunchingWithOptions:方法,从厦门国际银行的viewController初始化后
You can add admob's banner view to window at the end of application:didFinishLaunchingWithOptions: method, after initialising viewController from XIB.
GADBannerView *bannerView;
bannerView = [[[GADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)] autorelease];
bannerView.adUnitID = @"YOUR_ADMOB_ID";
bannerView.rootViewController = self.viewController;
[self.window addSubview:bannerView];
[bannerView loadRequest:[GADRequest request]];
这样,AdMob的旗帜将永远是在屏幕的顶部。
This way, admob banner will always be on top of the screen.
这篇关于如何在UIWebView的应用显示Admob的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!