- //用户取消正在执行的广告时 调用
- - (void)cancelBannerViewAction {
- NSLog(@"Banner was cancelled!");
- self.adStatus.text = @"[iAd]: Bannes was closed.";
- }
- //苹果公司给你发送一个广告 ! 通过此方法,广告视图ADBannerView 开始显示
- //此方法,每间隔一段时间(46秒) 刷新一次
- - (void)bannerViewDidLoadAd:(ADBannerView *)banner {
- NSLog(@"[iAd]: Ad did load.");
- self.adStatus.text = @"[iAd]: Ad did load.";
- }
- //someone 点击了 广告
- - (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave {
- NSLog(@"[iAd]: An action was started from the banner. Application will quit: %d", willLeave);
- self.adStatus.text =[NSString stringWithFormat: @"[iAd]: An action was started from the banner. Application will quit: %d", willLeave];
- return YES;
- }
- //广告执行完成,返回
- - (void)bannerViewActionDidFinish:(ADBannerView *)banner {
- NSLog(@"[iAd]: Action finished.");
- self.adStatus.text = @"[iAd]: Action finished.";
- }
- //加载广告错误,或者没有广告时,调用此方法,因为广告有时候会显示,有时候不会
- - (void)bannerView:(ADBannerView *) didFailToReceiveAdWithError:(NSError *)error {
- NSLog(@"[iAd]: Faild to load the banner: %@", error);
- self.adStatus.text = [NSString stringWithFormat:@"[iAd]: Faild to load the banner: %@", error];
- }