SomeGuy
SomeGuy

Reputation: 3845

How can I use two iAd views in the same view to switch back and forth?

I want to have the iAd banner switch randomly between the top and bottom of the screen each fill, but I can't seem to get two iAd banner views to work. I can't even get the iAd to appear at the top of the screen.

How would I change the position of the iAd banner? How would I make them swap at fill time?

Upvotes: 0

Views: 50

Answers (1)

Lenny
Lenny

Reputation: 164

In order to change the position of the ad banner, just set it's frame. Let's say you want to move it to the top of the screen, you would do: myAdBanner.frame = CGRectMake(0, 0, myAdBanner.frame.size.width, myAdBanner.frame.size.height);.

In order to find out when an ad is loaded, conform to ADBannerViewDelegate. Then, set the view controller as the delegate (myAdBanner.delegate = self;). When -bannerViewDidLoadAd: is called, you know an ad was filled, and you can switch the position of the ad banner.

Upvotes: 1

Related Questions