Question

This is my first time implementing iAd, so it is probably a newb mistake. In my app delegate I initialize an iAd banner view and assign it to a delegate property, then in my View Controller I add it as a subview to the view, then add the main view to the view. When it displays, only the top strip (perhaps 20 pixels) of the iAd banner are shown above the main view. I thought adding subviews to the main view controller's view would automatically manage the position of the views. If I don't show the main view, I can see the full iAd banner.

I checked the view's resizing mask, but I don't know how to specify that the main view gets "squeezed" below the iAd banner view.

Was it helpful?

Solution

Guess if I monkey around with it enough...what I did was set the bounding rectangle for the view, to start at the bottom of the iAd banner, and subtract the banner height from the view height.

In the View Controller's viewDidAppear method:

...
    [self.view addSubview:theAppDelegate.adBanner];
    CGRect mainViewFrame = CGRectMake(0, theAppDelegate.adBanner.bounds.size.height, myNavController.view.bounds.size.width, myNavController.view.bounds.size.height - theAppDelegate.adBanner.bounds.size.height);
    [myNavController.view setFrame:mainViewFrame];
    [self.view addSubview:myNavController.view];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top