I'm not too familiar with Three20 but I could tell you how I'd normally do it. You would want to write this code in adWhirlDidReceiveAd:
(assuming that you have read the tutorials on setting the correct delegate here and overriding that method, and that your ad view is a subview of the current view in your navigation controller).
So in adWhirlDidReceiveAd:
, you want to slide down your content (this is the view that's in you navigation controller) and slide in the ad that you receive.
- (void)adWhirlDidReceiveAd:(AdWhirlView *)adWhirlView_ {
CGSize adSize = [adWhirlView_ actualAdSize];
CGRect newFrame = adWhirlView_.frame;
newFrame.size = adSize;
newFrame.origin.x = (self.view.bounds.size.width - adSize.width)/ 2;
//Draw offscreen so that it can slide in properly
CGRect tempFrame = newFrame;
tempFrame.origin.y = -newFrame.size.height;
adWhirlView_.frame = tempFrame;
[UIView animateWithDuration:1.0 animations:^{
//Access frame of view controller in nav controller
CGRect viewFrame = [self.navigationController topViewController].view.frame;
// Decrease the height of the view by the height of the adwhirlView
viewFrame.size.height = [self.navigationController topViewController].view.frame.size.height -
adwhirlView_.frame.size.height;
// Shift view down to make room for the ad
viewFrame.origin.y = adwhirlView_.frame.size.height;
[self.navigationController topViewController].view.frame = viewFrame;
//Slide down the ad
adwhirlView_.frame = frame;
}];
}
You probably want to check if the first ad has already come in as well so you don't do the slide transition every time an ad comes in.
I'm pretty sure you could clean the code up I have there a lot as well, just wanted to throw my thoughts down while I could.