现在我开发了xcode xib的app工具。我觉得admob在app中运行不好。如果我把admob观点放在其他观点上。所有其他视图都无法获得触摸事件。像scrollview,tabbar ...... 但是,如果我把admob视图放在别人的底部。 Admob再也无法触碰。
代码在这里:
controller = [[UIViewController alloc]init];
controller.view.frame=CGRectMake(0, 0, rect.size.width, rect.size.height);
banner = [[GADBannerView alloc]initWithFrame:CGRectMake(
rect.origin.x,
rect.origin.y,
GAD_SIZE_320x50.width,
GAD_SIZE_320x50.height
)];
banner.adUnitID = GAD_BANNER_UNIT_ID;
banner.rootViewController = controller;
GADRequest *request;
if (self._isDebuged) {
request=[[GADRequest alloc]init];
request.testing=TRUE;
}else {
request=[GADRequest request];
}
[banner loadRequest:request];
[controller.view addSubview:banner];
我的观点结构:
window->rootViewController->rootView:
admob on the top
layer3:admob view container layer
layer2:tab bar
layer1:content view container
this cant touch any one except admob.
admob in the middle:
layer3:tab bar
layer2:admob view container layer
layer1:content view container
admob will cant display full screen because tabbar mask some area. and content cant touch.
admob at the bottom:
layer3:tab bar
layer2:content view container
layer1:admob view container layer
it works well with app, but cant touch admob any more.
答案 0 :(得分:0)
您的广告横幅的框架太大,无法覆盖controller.view。尝试这样的事情:
banner.frame = CGRectMake(0, 480-GAD_SIZE_320x50.height,
GAD_SIZE_320x50.width, GAD_SIZE_320x50.height);