This is a discussion on Implementing iAd Code Snippet within the Code Snippets forums, part of the iPhone/iPad Programming Tutorials category; 1) import the iAd framework in your project then add this code to your viewcontroller.h file: Code: #import <iAd/ADBannerView.h> 2) ...
1) import the iAd framework in your project then add this code to your viewcontroller.h file:
2) In your viewcontroller.m file:Code:#import <iAd/ADBannerView.h>
That's itCode:- (void)viewDidLoad { [super viewDidLoad]; ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero]; adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50; adView.delegate = self; //*********incredibly important*************// adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil]; CGRect myRect = CGRectMake(0, 0, 320, 50); adView.frame = myRect; adView.hidden = YES; adView.userInteractionEnabled = NO; } - (void)bannerViewDidLoadAd:(ADBannerView *)adView { //needed to remove iAd if there isn't any iAds there, required by Apple. adView.userInteractionEnabled = YES; adView.hidden = NO; [self.view addSubview:adView]; }![]()
MozyMac Founder,Chairman and CEO
MacBook Pro Unibody late 2008 2.4Ghz 4GB ram 250GB HD
MozyMac Youtube Channel
I used this piece of code and recieved a warning that would crash my app when the add wasnt present.
on the line:
adView.delegate = self;
//I got a warning that says : Class 'RootViewController' does not implement the 'ADBannerViewDelegate' protocol.
I'm confused on what this means
Thanks
Scientific
That's exactly your problem, you need to add the "ADBannerViewDelegate" sentence to your RootViewController header, for example, if your RootViewController implements the UITableViewController you just need to add it next to the UITableViewController
Code:@interface RootViewController : UITableViewController <ADBannerViewDelegate> { …
this is kinda cooo0ool![]()
I'm Rob, im new here! hello
___________________________________
New York Recording Studio ????