3
votes

I am using a UISplitViewController in my iPad app and I dont really like the way the popover view slides in and covers a third of the screen and stays there when in Portrait mode.

I am resizing the Detail view when the popover is slid into view and this works fine except the navigation bar at the top stay the full width (And goes underneath the popover). I basically want it to look like it does when in Landscape mode.

This is the code I use to resize the view:

UIViewController *masterView = [svc.viewControllers objectAtIndex:0];
UINavigationController *detailNavView = [svc.viewControllers objectAtIndex:1];
UIViewController *detailView = [detailNavView.viewControllers objectAtIndex:0];

detailView.view.frame = CGRectMake(masterView.view.frame.size.width, 0, detailView.view.frame.size.width - masterView.view.frame.size.width, detailView.view.frame.size.height);

I have tried settingdetailNavView.view.frame but nothing happens.

How can I resize the overall detail view including nav bar?

2

2 Answers

4
votes

Hmm, I think the UISplitViewController is not really that flexible. It's just something that Apple decided: split in landscape, popover in portrait. The detail view is occupying the whole view (i.e. the main view) of this controller, so you would have to define it as a subview of the main view of another kind of controller to manipulate its navigation bar like this.

The only solution to customize the portrait views is to actually do away with Apple's version of the split view controller and roll your own.

Perhaps the most pragmatic solution is just to dismiss the popover after an item is selected and displayed in the detail view.

0
votes

The answer is UISplitViewController's preferredPrimaryColumnWidthFraction property - set it from 0.0-1.0 to specify relative spacing master view takes up.