Chinaunix首页 | 论坛 | 博客
  • 博客访问: 378094
  • 博文数量: 466
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 10
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-16 13:59
文章分类

全部博文(466)

文章存档

2015年(466)

我的朋友

分类:

2015-03-16 14:32:40

http://developer.admob.com




SDK Integration instructions

1) 到网站注册,添加广告。之后会有一个admob sdk 下载界面,下载之后,里面有例子和一些文件。到你的工程之后添加如下的文件。AdMobDelegateProtocol.h, AdMobView.h, and libAdMob.a

如果使用objective c++那么需要引用的是这个 libAdMobNoThumb.a

(2) AudioToolbox, CoreGraphics, MediaPlayer, and MessageUI, QuartzCore 把以上的framework 添加到工程中。 

(3) TouchJSON 也在下载好的sdk里面,也要添加。

(4) 注册好了登陆,你会获得一个admob 的ID

(5) 具体的可以看下载好的例子里面,有相关的程序,sample code等。

一共有三种添加到程序中的广告的方法。

A) 使用Interface builder

  • Add AdViewController.h and AdViewController.m to your project (located in the IBSupport subdirectory).
  • Open Interface Builder.
  • Place a 320x48 UIView where you want the ad to appear.
  • Add an Object, and change its type to AdViewController.
  • Set the view outlet of the AdViewController to your UIView.
  • Set the currentViewController outlet of the AdViewController to the UIViewController owning the xib.
  • Edit AdViewController.m to make sure that your publisher ID and other options are set correctly.

B) 通过程序进行添加

  • Create an AdMob delegate class; it can be as simple as a class that only implements -publisherId and -currentViewController .
  • Add the following code to your view creation (modify as appropriate):
  AdMobView *ad = [AdMobView requestAdWithDelegate:]; 
// start a new ad request
  ad.frame = CGRectMake(0, 432, 320, 48); // set the frame, 
in this case at the bottom of the screen
  [self.window addSubview:ad]; // attach the ad to the view hierarchy;
 self.window is responsible for retaining the ad

C) 在 tableView里面添加一个广告

  • Create an AdMob delegate class; it can be as simple as a class that only implements -publisherId and -currentViewController.
  • Add to your -tableView:cellForRowAtIndexPath: method (modify as appropriate):
  [cell.contentView addSubview:[AdMobView requestAdWithDelegate:
]];
阅读(175) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~