1
votes

I'm updating my custom "iAD Banner Controller" to support iOS 7. It's basically an UIViewController container composed of 3 views:

  • the main view (the view of the contained controller)
  • the banner view
  • a status bar background view

When the AD is available, there is an animated transition that makes the banner view and the status bar background view appear sliding from the top. This is all managed using autolayout, and should appear like this (the status bar background is the green one, and in this case it contains an UINavigationController):

Correct

The problem is this: Using UINavigationController as the contained controller, when the banner is not visible, the nav controller extends 20px under the status bar. This is ok and expected. But, when I move it's superview (the container) down to let the iAD banner appear, the 20px extension remains there, with this result:

Wrong

However, if I do something like rotating the interface, the nav controller detects that the status bar is "far", and then adjusts itself.

I tried to call setNeedsStatusBarAppearanceUpdate and layoutIfNeeded respectively on the controller and it's view, without results.

I attach the whole project if you want to have a look: Link to the project

1

1 Answers

3
votes

By now I solved using a workaround: when the AD appear / disappear I call

[self.navigationController setNavigationBarHidden:YES animated:NO];
[self.navigationController setNavigationBarHidden:NO animated:NO];

using this workaround, I force UINavigationController to detect again that the status bar is "far" and It has to recalculate the offset. Since my view hierarchy is not so simple, and I want to re-use my AD Controller in other projects, I used a Notification to alert that the AD was appearing/disappearing.

I'll wait for other better answer a few day before marking this as correct. Thanks