转载自:http://mo7amedfouad.com/2011/08/how-to-integrate-iad-in-your-ios-app/

There is no doubt that the ad industry pushes a lot of companies and individuals to work and grow. the main revenue for Google is AdSense.So why not you get a piece from the pie?.
What is iAD ?

The iAd advertising platform provides developers new opportunities to generate revenue and promote their apps. You add banner or full-screen advertisements to your application’s user interface; Apple sells advertising space and delivers ads to fill these spaces. You earn revenue when users view or interact with ads displayed by your application.

How to integrate iAD in your app ?

The first thing you need to do is to add iAd.framework in your Xcode project which is contained in iOS 4 SDK. Also do not forget to add #import . Developers can choose between two banners: 320×50 px for portrait and 480×32 px for landscape.

For best practices sake:

  • Create and initialize your ADBannerView object in your AppDelegate (SharedAdBannerView).
  • Share the same object a cross your app files.
  • Make sure you remove the ADBannerView when leaving the current view by calling  SharedAdBannerView removeFromSuperview in viewWillAppear delegate
  • You can customize the postion of the iADBannerView in any view but make sure to rest it location when leaving the view using viewWillDisappear

iADAppDelegate.h

?
1
2
3
4
5
6
7
8
#define SharedAdBannerView ((iADAppDelegate *)[[UIApplication sharedApplication] delegate]).adBanner
@interface iADAppDelegate : NSObject <UIApplicationDelegate ,ADBannerViewDelegate> {
 UIWindow *window;
 UITabBarController *tabBarController;
 ADBannerView *adBanner;
}
@property   (nonatomic,retain) ADBannerView *adBanner;

iADAppDelegate.m

?
1
2
3
4
5
6
7
8
9
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
adBanner = [[ADBannerView alloc] initWithFrame:CGRectZero];
adBanner.currentContentSizeIdentifier =ADBannerContentSizeIdentifierPortrait;
adBanner.delegate = self;
adBanner.backgroundColor = [UIColor clearColor];
adBanner.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin;
 return YES;
}

in any controller or view you can position the ad as you want

?
1
2
3
4
5
6
-(void)viewWillAppear:(BOOL)animated
{
   [SharedAdBannerView removeFromSuperview];
   [SharedAdBannerView  setFrame:CGRectMake(0, 317, 320, 50)];
   [self.view addSubview:SharedAdBannerView];
}

Code strong

转载于:https://www.cnblogs.com/viktyz/archive/2012/08/17/2872129.html

How to integrate iAD in your iOS App ?相关推荐

  1. Xcode couldn‘t find any iOS App Development provisioning profiles matching ‘com.example.***‘

    在更新完iOS14.3后,Xcode真机调试时报错,无法进行真机测试: 报以下错误: No profiles for 'com.example.software.Login' were found: ...

  2. ios app 砸壳

    这里介绍使用dumpdecrypted砸壳.原理是用DYLD_INSERT_LIBRARIES这个环境变量加载脱壳的动态链接库dumpdecrypted.dylib 1.ssh连接上越狱的机器,输入密 ...

  3. iOS App 连接外设的几种方式

    原创作者: Max_Marry 文章地址: http://www.jianshu.com/p/852bf92c5c92 随着近年来车联网和物联网的兴起,智能家居和智能硬件的逐步火热,越来越多的 App ...

  4. iOS App上架流程(2016详细版),真心很详细。

    一.前言: 作为一名iOSer,把开发出来的App上传到App Store是必要的.下面就来详细讲解一下具体流程步骤. 二.准备: 一个已付费的开发者账号(账号类型分为个人(Individual).公 ...

  5. iOS App上架流程

    一.前言: 作为一名iOSer,把开发出来的App上传到App Store是必要的.下面就来详细讲解一下具体流程步骤. 二.准备: 一个已付费的开发者账号(账号类型分为个人(Individual).公 ...

  6. iOS APP提交上架最新流程

    iOS APP提交上架最新流程 反复提交的过程中对上架流程熟悉了好多,写篇帖子送给同为菜鸟的你,如果里面有很菜的东西,大牛请自动忽略,毕竟这也是还为菜鸟的我的备忘录呢! 首先得描述一下各个证书的定位, ...

  7. Xcode7.1环境下上架iOS App到AppStore 流程 (2)

    前言部分 part二部分主要讲解 iOS App IDs 的创建.概要文件的配置.以及概要文件安装的过程. 一.iOS App IDs 的创建 1)进入如图1所示界面点击右上角箭头所指的加号 进入iO ...

  8. iOS App上架流程(2016详细版)

    iOS App上架流程(2016详细版) 原文地址:http://www.jianshu.com/p/b1b77d804254 感谢大神整理的这么详细 一.前言: 作为一名iOSer,把开发出来的Ap ...

  9. ipad php mysql_如何用PHP/MySQL为 iOS App 写一个简单的web服务器(译) PART1

    原文:http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app 作为一个i ...

  10. IOS APP 国际化 程序内切换语言实现 不重新启动系统(支持项目中stroyboard 、xib 混用。完美解决方案)

    IOS APP 国际化 程序内切换语言实现 不重新启动系统(支持项目中stroyboard .xib 混用.完美解决方案) 参考文章: (1)IOS APP 国际化 程序内切换语言实现 不重新启动系统 ...

最新文章

  1. bae 3.0 mysql_bae3.0 mysql 有时报错?报错-问答-阿里云开发者社区-阿里云
  2. 反向域名解析的用途,如何设置?
  3. openwrt l7过滤qos配置
  4. Android 简单基站定位程序
  5. 谷歌浏览器打开tif_谷歌打开后是搜狗浏览器??怎么办
  6. vue-cli搭建和“Cannot find module npm-cli.js” 、“operation not permitted” 、 deprecated coffee-script等错误
  7. 没有UITableViewController的UIRefreshControl
  8. 老年手机计算机的按键怎么调至桌面,怎样设置一键回到桌面啊,就是这个图标(如图)...
  9. Nginx Upload Module 上传模块
  10. plaintextedit指定一行一行的高亮显示_RDKit | 基于RDKit的指定原子或键高亮
  11. 如何在Ubuntu18.4中设置ERPNEXT开源ERP生产环境开机运行
  12. Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Cou
  13. C_Primer第12章 存储类型、链接和内存管理
  14. 首席科学家马丁•福勒(Martin Fowler)
  15. 如何清理Linux跟下的垃圾文件
  16. Telegram Bot Api使用教程
  17. 计算机组成acc什么意思,计算机组成作业老师给的答案[沐风教育]
  18. Web GIS多种方式发布动态地图服务及显示(2)
  19. js 中的 exec( )方法
  20. 数电和Verilog-基础概念

热门文章

  1. 阿里多语言翻译模型的前沿探索及技术实践
  2. 【微软ALUM】当语言模型遇到对抗训练
  3. 【面经】字节AI Lab-NLP算法热乎面经
  4. 【文本摘要】BottleSum——文本摘要论文系列解读
  5. 【机器学习】决策树的理论与实践
  6. 这么好的视频不看吗?深度学习和线代,微积分
  7. pytorch入门——线性回归
  8. 火山同传助力第四届CTDC首席技术官领袖峰会
  9. 数据科学包4-pandas核心数据结构
  10. 李飞飞力荐:阿里巴巴高可用数据库解决方案