导入 iAd.framework
#import "ViewController.h"
#import <iAd/iAd.h>
//遵守协议
@interface ViewController ()<ADBannerViewDelegate>
//广告的View
@property (weak, nonatomic) IBOutlet ADBannerView *bannerView;
//约束 加载完成改变
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *cons;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.bannerView.delegate = self;
}
//加载完广告会调用
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
self.cons.constant = 8;
[UIView animateWithDuration:2.0 animations:^{
[self.view layoutIfNeeded];
}];
NSLog(@"加载完毕");
}
@end
网友评论