1

i have an adbanner on my first screen (ViewController) and i was wondering what would be the best possible way to implement adbanners on my other screens (ViewControllers) so that my app doesnt get rejected by apple just because i did it wrong - i have like 20 of them.

Do i just simply copy and paste the banner from the first screen onto the rest or do i have to rewrite and add some code

This is my AdBanner code in the .h file

@interface ViewController : UIViewController <ADBannerViewDelegate>
@property (weak, nonatomic) IBOutlet ADBannerView *banner;

@end

This is my AdBanner code in the .m file

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];
self.banner.delegate = self;
}

- (void) viewDidLayoutSubviews {
if (self.banner.bannerLoaded) {
    CGRect contentFrame = self.view.bounds;
    CGRect bannerFrame = self.banner.frame;
    contentFrame.size.height -= self.banner.frame.size.height;
    bannerFrame.origin.y = contentFrame.size.height;
    self.banner.frame = bannerFrame;
}
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave
{
NSLog(@"bannerViewActionShouldBegin");
return YES;
}

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
NSLog(@"bannerViewDidLoadAd");
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"didFailToReceiveAdWithError");
}

- (void)bannerViewActionDidFinish:(ADBannerView *)banner {
NSLog(@"bannerViewActionDidFinish");
}

@end

any suggestions and help is much appreciated.

madLokesh
  • 1,860
  • 23
  • 49
  • @Renan i didnt say i wasnt following the rules... you misunderstood. im simply asking for help as to whether copying and pasting the same adbanner from my first screen onto the rest of the other screens would be fine... thats all so please you dont have to be so harsh for no reason – user2459150 Jul 17 '13 at 12:15
  • I saw you edited the question and changed my vote. At first it did seem like you wanted to force something that was not allowed. Thanks for clarifying. I don't have an answer for you, but I hope you get one. – Geeky Guy Jul 17 '13 at 12:19

1 Answers1

0

Grab the iAdSuite sample code from Apple and look at the ContainerBanner sample. This lets you have one place where you have your iAd code and the BannerViewContainer handles all the heavy lifting.

Paul Cezanne
  • 8,629
  • 7
  • 59
  • 90