iOS Development-Advanced Technology & Advertising Services

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.