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 — clean the code


When you begin to duplicate code, you're increasing the efforts required to maintain your app, because you have to go through every instance and change it. In our last exercise, we have three similar blocks of code that we can combine into one method that intelligently handles the situations. This function will handle the hiding and displaying of our ad, depending on the banner's availability. Continuing with our demo app, complete the following steps to clean up the code:

  1. 1. Before the delegate methods of the banner, and before the pragma mark, create an empty method by adding this code:

    -(void) adjustBannerVisibility
    {
    }
    
  2. 2. We'll need to add the following to the header file, iAd_Demo_AppViewController.h, before the @end statementin the file add to tell the project that this new method is available:

    -(void) adjustBannerVisibility;
    
  3. 3. This will suppress any warnings from Xcode about unknown methods. Now return back to the main file—iAd_Demo_AppViewController...