How do I make my iAd banner appear at bottom of screen?

jini picture jini · Nov 3, 2011 · Viewed 9.3k times · Source

I have the following code that allows me to position it on the top. I am wanting it to appear at the bottom.

 adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
 adView.frame = CGRectOffset(adView.frame, 0, -50);
 adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
 adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
 [self.view addSubview:adView];

Any assistance will be appreciated.

Answer

james_womack picture james_womack · Nov 3, 2011

Update—@larsacus pointed out this is for 4.2+:

adView = [[ADBannerView alloc] initWithFrame:CGRectZero];
adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
CGRect adFrame = adView.frame;
adFrame.origin.y = self.view.frame.size.height-adView.frame.size.height;
adView.frame = adFrame;
[self.view addSubview:adView];

Shown working in simulator