0
我正在使用此调用横幅;需要删除一个子视图
[self.view addSubview:[[AdManager sharedInstance] adMobBanner]];
它从AdManager.m文件中调用;
- (GADRequest *)adMobrequest {
GADRequest *request = [GADRequest request];
request.testDevices = @[
// TODO: Add your device/simulator test identifiers here. Your device identifier is printed to
// the console when the app is launched.
GAD_SIMULATOR_ID,
];
return request;
}
-(GADBannerView*)adMobBannerWithAdUnitID:(NSString*)adUnitID{
GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake([UIScreen mainScreen].bounds.size.width, AdmobBannerHeight)) origin:CGPointMake(0,
[UIScreen mainScreen].bounds.size.height -AdmobBannerHeight)];
bannerView.adUnitID = adUnitID;
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];
// Example: 1 UIKit 0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]];
[array removeObject:@""];
bannerView.rootViewController = [array objectAtIndex:3];
[bannerView loadRequest:[[AdManager sharedInstance] adMobrequest]];
return bannerView;
}
-(GADBannerView*)adMobBanner{
GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake([UIScreen mainScreen].bounds.size.width, AdmobBannerHeight)) origin:CGPointMake(0,
[UIScreen mainScreen].bounds.size.height -AdmobBannerHeight)];
bannerView.adUnitID = ADMOB_BANNER_ID;
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];
// Example: 1 UIKit 0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]];
[array removeObject:@""];
bannerView.rootViewController = [array objectAtIndex:3];
[bannerView loadRequest:[[AdManager sharedInstance] adMobrequest]];
return bannerView;
}
-(GADBannerView*)adMobBannerWithAdUnitID:(NSString*)adUnitID andOrigin:(CGPoint)origin
{
GADBannerView *bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeFromCGSize(CGSizeMake([UIScreen mainScreen].bounds.size.width, AdmobBannerHeight)) origin:origin];
bannerView.adUnitID = adUnitID;
NSString *sourceString = [[NSThread callStackSymbols] objectAtIndex:1];
// Example: 1 UIKit 0x00540c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
NSCharacterSet *separatorSet = [NSCharacterSet characterSetWithCharactersInString:@" -[]+?.,"];
NSMutableArray *array = [NSMutableArray arrayWithArray:[sourceString componentsSeparatedByCharactersInSet:separatorSet]];
[array removeObject:@""];
bannerView.rootViewController = [array objectAtIndex:3];
[bannerView loadRequest:[[AdManager sharedInstance] adMobrequest]];
return bannerView;
}
这很好,不过,我需要停止出现在某一点(如购买)这个观点,我现在有一个NSNotification集,在购买时,隐藏的旗帜,我就是” t似乎隐藏它!
我想这将是一个设置从超级视图中删除视图的情况,但似乎无法找到正确的方式。
确实,这个作品完美!非常感谢您的帮助 - 标记为完整! – user3355723 2014-09-24 17:12:46