0

I have UITableViewController I want to add ADBannerView to its footer

so I added the framework iAd.framework , and tried the following code

- (void)viewDidLoad {

    [super viewDidLoad];

    ADBannerView* adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
    adView.frame = CGRectOffset(adView.frame, 0, -50);
    adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;

    [self.tableView.tableFooterView addSubview:adView];
}

But it doesn't appear.

am I missing something or what

Best regards

AMH
  • 6,363
  • 27
  • 84
  • 135
  • Have you google it.You will find many of the sample codes related to iads.What the change you have to do is add your ADBannerView in table view instead of main view. – Gypsa Feb 15 '12 at 08:32
  • I did as in the exampels , what's wrong – AMH Feb 15 '12 at 08:37
  • thanks I solved the problem and updated my question with another one – AMH Feb 15 '12 at 09:12

1 Answers1

1

That's not going to work. You'll have to implement the datasource method called tableView:viewForFooterInSection: and return the adbanner view. You might also have to implement the delegate method tableView:heightForFooterInSection:

Vinnie
  • 1,670
  • 14
  • 16
  • it worked but I need it to be at the bottom of the screen not at the end of the table data, also why it doesn't show any ads, any ideas – AMH Feb 15 '12 at 09:39
  • It should only show that test ad while your in development. you won't get live ads until you publish to the store. To put the ad at the bottom of the screen, you'll have to shrink the size of your table view to make room at the bottom, then put it in your hierarchy with [self.view addSubview:adView]. You'll also need to use a regular UIViewController with a custom tableView property, because UITableViewController puts the table view full length. – Vinnie Feb 15 '12 at 16:54