Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS7 UISplitViewController status bar

I am trying to add splitview controller as child view controller. parent view controller is navigation controller. the navigation bar is hidden for parent view controller and i wanted to show status bar as iOS 6 standard. I have added splitview controller as child view controller as i wanted to push to another view controller from splitview controller.

Problem i am facing is i when i am adding splitview controller, status bar overlaps on content. setting edgesForExtendedLayout to UIRectEdgeNone for masterview, detailview, parentview, splitview doesn't seems to be working.

Please let me know the solution i can apply to prevent the contents overlaping from status bar and show status bar as ios 6 standards.

I tried doing it with MGSplitViewController, but was facing the same issue.

Thanks.

like image 265
xmax Avatar asked Sep 25 '13 18:09

xmax


1 Answers

I have the exact same issue, and was able to solve this problem. I have a UITabBarController at the root with a different UISplitViewController on each of the first two tabs. For some of my Detail views I was having it overlap with both the navigation bar at the top and the tab bar at the bottom.

I tried setting edgesForExtendedLayout as well without success at first, but it turns out you need to set it as early on as possible for it to have effect. You didn't specify in your question where exactly you were setting your property, so I'm hoping this will help you as well: set the edgesForExtendedLayout to UIRectEdgeNone in the -viewDidLoad of your UIViewController.

This is the code that fixed it for me, while earlier attempts to do this in -viewWillLayoutSubviews had no effect at all:

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Prevent detail screen from sitting underneath navigation bar and tab bar:
    self.edgesForExtendedLayout = UIRectEdgeNone;
}

Hope this helps...

Erik

like image 174
Erik van der Neut Avatar answered Nov 17 '22 12:11

Erik van der Neut