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