Để kiểm soát iAd trong điều khiển điểm của bạn, bạn có thể thiết lập một đại biểu lắng nghe iAd khẳng định:
@interface MyViewController : UIViewController <ADBannerViewDelegate>
...
@property (nonatomic, weak) IBOutlet ADBannerView* banner;
@end
sau đó trong tập tin thực thi của bạn:
@implementation MyViewController
- (void)viewDidLoad
{
...
[_banner setHidden:YES];
_banner.delegate = self;
}
...
#pragma mark - ADBannerViewDelegate implementation
- (void)bannerView:(ADBannerView*)banner didFailToReceiveAdWithError:(NSError*)error
{
// iAd is not available, so we are going to hide it to get rid of ugly white rectangle
[_banner setHidden:YES];
// Here you can add your logic to show your other ads
}
- (void)bannerViewDidLoadAd:(ADBannerView*)banner
{
// iAd is available, lets show it
[_banner setHidden:NO];
// Here you can add your logic to hide your other ads
}
@end
Ngoài ra tôi thường giữ chỉ là một thể hiện của ADBannerView, có nó trong App Delegate của tôi và một khi một số bộ điều khiển xem xuất hiện trên màn hình - tôi chỉ cần thêm ADBannerView đó để xem hệ thống phân cấp của bộ điều khiển xem và loại bỏ nó khi bộ điều khiển xem biến mất.
Cảm ơn, nhưng tôi đang tìm quảng cáo chuyển tiếp. –
Tệ của tôi. Bạn đã xem đại diện quảng cáo xen kẽ chưa? https://developer.apple.com/library/ios/documentation/iAd/Reference/ADInterstitialAdDelegate_Ref/Introduction/Introduction.html#//apple_ref/occ/intf/ADInterstitialAdDelegate – interrupt
Dường như họ làm những việc khác nhau cho iPhone. Bạn không tạo AdInterstitialAd, thay vào đó, họ đã thêm phương thức vào UIViewController. Nhưng tôi nghĩ rằng tôi có một giải pháp, tôi đang chỉnh sửa câu trả lời của mình bên dưới. –