Hi,
I am trying to add iAds to a tableview.
Specifically, the SimpleEKDEMO source code here:
http://developer.apple.com/library/ios/#samplecode/SimpleEKDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010160
Appreciate it if someone could download / take a look at the source code for me and see what I'm missing in terms of adding an iAd banner (which hides if there's no content, loads an ad if there is content) to the tableview
Here's what I have so far....thanks
I am trying to add iAds to a tableview.
Specifically, the SimpleEKDEMO source code here:
http://developer.apple.com/library/ios/#samplecode/SimpleEKDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010160
Appreciate it if someone could download / take a look at the source code for me and see what I'm missing in terms of adding an iAd banner (which hides if there's no content, loads an ad if there is content) to the tableview
Here's what I have so far....thanks
Code:
#import "RootViewController.h"
@implementation RootViewController
@synthesize eventsList, eventStore, defaultCalendar, detailViewController;
@synthesize bannerView;
#pragma mark -
#pragma mark Memory management
- (void)dealloc {
bannerView.delegate= nil;
[bannerView release];
[eventStore release];
[eventsList release];
[defaultCalendar release];
[detailViewController release];
[super dealloc];
}
-(void) moveBannerViewOffscreen
{
CGRect originalTableFrame = self.tableView.frame;
CGFloat newTableHeight = self.view.frame.size.height;
CGRect newTableHeight = originalTableFrame;
newTableFrame.size.height = newTableHeight;
CGRect newBannerFrame = self.bannerView.frame;
newBannerFrame.origin.y = newTableHeight;
self.tableView.frame = newTableFrame;
self.bannerView.frame = newBannerFrame;
}
-(void) moveBannerViewOnscreen
{
CGRect newBannerFrame = self.bannerView.frame;
newBannerFrame.origin.y = self.view.frame.size.height - newBannerFrame.size.height;
CGRect originalTableFrame = self.tableView.frame;
CGFloat newTableHeight = self.view.frame.size.height - newBannerFrame.size.height;
CGRect newTableFrame = originalTableFrame;
newTableFrame.size.height = newTableHeight;
[UIView beginAnimations:@"BannerViewIntro" context:NULL];
self.tableView.frame=newTableFrame;
self.bannerView.frame=newTableFrame;
[UIView commitAnimations];
}
-(void)bannerView:(ADBannerView *)banner
didFailToReceiveAdWithError: (NSError *) error
{
[self moveBannerViewOffscreen];
}
-(void)bannerViewDidLoadAd:(ADBannerView *)banner
{
[self moveBannerViewOnscreen];
}