Skip to content

Instantly share code, notes, and snippets.

@Rockncoder
Created May 25, 2012 13:40
Show Gist options
  • Select an option

  • Save Rockncoder/2788231 to your computer and use it in GitHub Desktop.

Select an option

Save Rockncoder/2788231 to your computer and use it in GitHub Desktop.
AdMobCalculator
// Create a view of the standard size at the bottom of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
// Must be a better way to position at bottom of page
[bannerView_ setCenter:CGPointMake(kGADAdSizeBanner.size.width/2, 435)];
// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
// Initiate a generic request to load it with an ad.
GADRequest *request = [GADRequest request];
// remove this line when you are ready to deploy for real
request.testing = YES;
[bannerView_ loadRequest:request];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment