Book Image

iAd Production Beginner's Guide

By : Ben Collier
Book Image

iAd Production Beginner's Guide

By: Ben Collier

Overview of this book

Think of an iAd as a micro-app contained within an app on a user's iPhone or iPad that they've downloaded from the App Store. When the user taps your advert's banner it bursts into life filling the entire screen of their device. iAd Beginner's Guide takes you through the start to finish process of building rich, compelling, interactive iAds. You will learn to create beautiful multi-page ads with store finders, social sharing, 3D images and video galleries. You will create ads that utilize the powerful technologies in the iPhone to make your brand shine. Once you have engaged the user you can carry out targeted advertising campaigns with location-based coupons, store finders and social engagement. Using the iTunes Store you will see how it's even possible to add one-click digital content purchasing right within your ad. Learn how iAd producer manages all the HTML5, JavaScript, and CSS3 behind your iAd. You will be creating emotive, gripping and effective mobile advertising campaigns in no time.
Table of Contents (18 chapters)
iAd Production
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Time for action — ban the banner


With a few small tweaks to our view and code, we can animate our banner on and off the screen, depending on the availability of ads:

  1. 1. Open the demo project, or your own project containing an Ad Banner View, in Xcode. Open the main controller file for your view, for example, iAd_Demo_AppViewController.m.

  2. 2. Lets' assume that an ad is always going to fail and move the banner out of view as soon as the app comes into view. We'll then wait for the successful message from the iAd Network and bring it into view. Add this following code around line 30:

    - (void)viewWillAppear:(BOOL)animated
    {
    CGRect frame = self.view.bounds;
    CGPoint bannerOrigin =CGPointMake(CGRectGetMinX(frame), CGRectGetMaxY(frame));
    bannerView.frame = CGRectMake(bannerView.bounds.origin.x, bannerOrigin.y, bannerView.frame.size.width, bannerView.frame.size.height);
    }
    
  3. 3. This takes the frame of the banner and sets the y value to be the height of the current view, which repositions it off screen...