当我将bannerView 设置为隐藏时,我的应用上仍然有一个白框。广告消失了,但它占据的空间现在被一个白框挡住了。
我正在使用 XCode 4.5.2、Cordova 2.2 和 Google AdMob Ads Sdk iOS 6.2.1
我正在使用这个插件https://github.com/ellemayo/phonegap-plugins-1/tree/master/iOS/AdMobPlugin
我也使用这个答案中的代码:How to toggle admob view from MainViewController using Cordova
(void)hideAd:(NSMutableArray *) 参数
withDict:(NSMutableDictionary *)options {
CDVPluginResult *pluginResult;
NSString *callbackId = [参数弹出];
如果(!self.bannerView){
// 尽量防止在没有先createBannerView的情况下调用requestAd
// 被调用。
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
messageAsString:@"AdMobPlugin:"
@"不存在广告视图"];
[self writeJavascript:[pluginResult toErrorCallbackString:callbackId]];
返回;
}
BOOL isHidden = (BOOL)[[options objectForKey:@"isHidden"] boolValue];
self.bannerView.hidden = isHidden;
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self writeJavascript:[pluginResult toSuccessCallbackString:callbackId]];
}
我用这个javascript调用它:
window.plugins.AdMob.hideAd({
'isHidden':真
},
功能(){},
功能(){}
);