masterViewController in UISplitViewController not shown - ios

I have a tabbarcontroller with 3 tabs that are splitviewcontrollers.
It works fine except when:
in portrait view tap the rootview button to show the master
popover.
switch to any other tab
rotate to landscape (the masterview controller of that tab appears)
switch back to first tab and the detail view controller is in the
right position (320 px from left border) but instead the master view
I have a black screen
I enumerated the splitviewcontroller subviews but the masterview is not there.
If I rotate the device in portrait and back in landscape, the master view appears.
I try to better explain with this picture:

It seems to me that the problem might be caused by all of your UISplitViewControllers using the same delegate, probably your AppDelegate. That might cause the behavior you're seeing, since when one UISplitViewController returns false from collapseSecondaryViewController:ontoPrimaryController, they all will return false, giving you the padding on the left to make space for the masterViewController. But your UISplitViewControllers which are not active aren't showing the masterViewController, so you get a blank space, instead of what you expect.

Related

Layouts are not updated when navigated back with different device orientation

I have a custom tab bar controller with 4 tabs which manages 4 view controllers, and I support rotation of the device. When I tap one of the tab items and the corresponding view controller and associated view are loaded and shown, changes in the layout by rotating the device are ok. However if, for example, I'm showing a view with the device in portrait orientation, then I tap another tab item and its corresponding view is shown, I rotate this view to landscape, and then, still being in landscape, I go again to the first view by taping its tab item, then such view, that was in portrait when it disappeared, is now in landscape with the portrait sizes and appearance (right-half of the screen is empty and views go out in height)...
What is the way to update the layouts in such situations?

Rotating SplitViewController messes up toolbar in master view

I have a SplitViewController. In the master view I have a toolbar that is attached to the status bar.
When I launch the app in landscape mode (master view is visible), it looks great:
I launch in portrait:
After launching in portrait I rotate the screen to landscape. The master view appears as it should, but the toolbar is no longer attached to the status bar.
As you can see the toolbar is too small now and runs into the status bar. I have the delegate setup correctly to tell the toolbar to attach to the status bar. This problem only seems to happen when I start the device in portrait and rotate it.
I have tried to force the master view to re-layout by calling setNeedsLayout in viewWillAppear but that makes no difference.
Please help!
Just a guess, but make sure that in your view controllers that this is set appropriately:
- (BOOL)prefersStatusBarHidden
{
return NO
}

iOS, iPad - NavigationBar appears on rotating device

I have an issue with the navigation bar.
I have screen with NavBar and opened half transparent view on full screen (it covers NavBar).
Then, if I change device orientation by 180 degree (my app only, for landscape), then NavBar appears on top while animation. NavBar goes back under transparent view after animation completes.
Does somebody face the same issue?
How are you presenting the transparent view? If you are presenting it modally or using a UIPopover, both of these will be removed from the window during the rotation and then added back afterwards.
Have you perhaps tried adding the view as a subview of the window, above the navigation bar, like such?
[self.view.window insertSubview:your_view aboveSubview:self.navigationController.view];

iPad Modal View Dismissal Changes Parent View Orientation

I have an iPad Split View Application that brings up a modal view to display certain content. When I bring up the modal (in PageSheet style) and then change from Portrait to Landscape (or vice-versa) and then dismiss the modal the orientation of the detailViewController (the parent of the modal) turns 90 degrees.
So if I am in landscape mode when I close the modal the right pane will turn as if it were in portrait mode but the device is still in Landscape and the rootViewController is still visible. After this happens no rotation will solve the problem until the view is removed.
Any idea what I've screwed up here? I've had a ton of trouble with iPad rotation handling in general but this one is really giving me problems.
If you are presenting the modal view from either of the two sub-views of the SplitViewController, then you will have the orientation problems. Just present the modal view from the SplitViewController.

UITableview not rotating correctly in UIPopover

I have a UITableview inside a popover. Initially the popover is displayed in portrait and upon rotation to landscape it disappears as expected. When rotated back to portrait and the popover is caused to be presented again, the tableview is shown in landscape mode inside the popover. How can I prevent the tableview from rotating, or cause it to rotate back?
Keep a reference to the popover in the view controller that opens it. That view controller will receive willRotate messages. You can dismiss the popover from there.

Resources