IOS广告

导入 iAd.framework
#import "ViewController.h"
#import
//遵守协议
@interface ViewController ()
//广告的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

你可能感兴趣的:(IOS广告)