Advertising Services
It is also mentioned that another source of revenue for iOS development is advertising, there are a lot of advertising services on iOS can be integrated, using more is Apple's iad, Google's admob, below a brief demonstration of how to use IAD to integrate ads. The process of integrating ads with IAD is simple, first introducing the Iad.framework framework and then creating Adbannerview to show ads, typically setting up Adbannerview proxy methods to listen for ad clicks and hide the ad display controls when the ad load fails. The following code is a simple demonstration of this process:
1 //2 //VIEWCONTROLLER.M3 //kctest4 //5 //Created by Kenshin Cui on 14/4/5.6 //Copyright (c) 2015 Cmjstudio. All rights reserved.7 //8 #import "ViewController.h"9 #importTen @interfaceViewcontroller () One@property (Weak, nonatomic) Iboutlet Adbannerview *advertisebanner;//AD Presentation View A @end - @implementationViewcontroller -- (void) Viewdidload { the [Super Viewdidload]; - - //Set up proxy -Self.advertisebanner.Delegate=Self ; + } - #pragmaMark-adbannerview Proxy method + //AD Loading Complete A-(void) Bannerviewdidloadad: (Adbannerview *) banner{ atNSLog (@"The ad load is complete."); - } - //When you click Banner, return to No will not expand full screen ads --(BOOL) Bannerviewactionshouldbegin: (Adbannerview *) Banner willleaveapplication: (BOOL) willleave{ -NSLog (@"Click Banner before you leave."); - returnYES; in } - //Click Banner to display full screen, close and call after to-(void) Bannerviewactiondidfinish: (Adbannerview *) banner{ +NSLog (@"The ad is closed."); - } the //failed to get ad *-(void) Bannerview: (Adbannerview *) banner didfailtoreceiveadwitherror: (Nserror *) error{ $NSLog (@"failed to load the ad.");Panax Notoginsengself.advertisebanner.hidden=YES; - } the @end
Operating effect:
iOS Development-Advanced Technology & Advertising Services