项目需要加广告,所以看了一下相关代码,很简单.
1.iAD 需要加入iad.framework
//.h
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface ViewController : UIViewController<ADBannerViewDelegate>
@end
//.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic,strong)ADBannerView *adView;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.adView = [[ADBannerView alloc]initWithFrame:CGRectMake(0, 80, 320, 100)];
self.adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;