IOS广告
2015-05-27 本文已影响396人
mayday2024
导入 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