4

IEverything works fine before iOS 6. I have a UIViewController subclass in a UINavigationController as usual. Its view is shrinking down about 20 px as if there is another status bar up top. When I push and pop the view back. The view went back to its correct position. I found out it's because UIViewControllerWrapperView (got by using self.view.superview) frame got wrong somehow in iOS 6.

Doing NSLog in viewDidAppear

At app launch ...

self.view.frame: {{0, 0}, {768, 891}} // was {{0, 0}, {768, 911}} in iOS5.1
self.view.superview: <UIViewControllerWrapperView: 0x9dddb80; frame = (0 20; 768 891); autoresize = W+H; layer = <CALayer: 0x9dddc30>> 
// was (0 0; 768 911); in iOS5.1

After push and pop view controller (correct value) ...

self.view.frame: {{0, 0}, {768, 911}}
self.view.superview: <UIViewControllerWrapperView: 0x9dddb80; frame = (0 0; 768 911); autoresize = W+H; layer = <CALayer: 0x9dddc30>>

It never happens before. How does this appear in iOS 6 ?

Hlung
  • 13,850
  • 6
  • 71
  • 90

2 Answers2

2

Here is my current dirty fix in viewDidAppear.

// fix wrong UIViewControllerWrapperView frame by moving up and extending it back
CGRect wvFrame = self.view.superview.frame;
if (wvFrame.origin.y > 0) {
    wvFrame.size.height += wvFrame.origin.y;
    wvFrame.origin.y = 0;
    self.view.superview.frame = wvFrame;
}
Hlung
  • 13,850
  • 6
  • 71
  • 90
1

There's a better fix than accepted. Try to set wantsFullScreenLayout to YES in viewDidLoad.

self.wantsFullScreenLayout = YES;