在这里,我先给大家介绍以下如何添加iAd广告,当然了,在这一讲,我先给大家介绍的是如何用代码实现添加iAd的效果,接下来,我会接续说说如何真正在我们应用里在发布时能用到。
先给自己的项目添加iAd.framework库
接着在头文件中添加下面代码:
#import <UIKit/UIKit.h>
#import <iAd/iAd.h>
@interface iAdsDemoViewController : UIViewController
<ADBannerViewDelegate> {
ADBannerView *adView;
}
@end
在实现里添加如下代码:
//
// iAdsDemoViewController.m
// iAdsDemo
//
// Created by gao wei on 10-6-12.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import "iAdsDemoViewController.h"
@implementation iAdsDemoViewController
- (void)viewDidLoad {
//竖屏
adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
//adView.currentConte