xmax
xmax

Reputation: 231

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.

Upvotes: 7

Views: 2489

Answers (3)

Erik van der Neut
Erik van der Neut

Reputation: 2235

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

Upvotes: 1

bLacK hoLE
bLacK hoLE

Reputation: 801

I think you have to use the viewcontrollers parent, and child with enabled navigation controller may help you. If it doesn't then try this tutorial. This helps me a lot, I hope it can help you as well.

Upvotes: 0

Steve
Steve

Reputation: 2526

When you say:

I am trying to add split view controller as child view controller.

Do you mean setting the UISplitViewController as the rootViewController? If not that could be why it's acting weird.

However UISplitViewControllers are not designed to work in this way, see this answer https://stackoverflow.com/a/2642701/383603

I would use the container view controller to create a custom split view controller: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html

Loads of good links here: Container View Controller Examples

Obviously a bit annoying having to recreate it but at least you get full control its behaviour.

Upvotes: 0

Related Questions