iosuisplitviewcontrollermaster-detailuitabcontroller

Bug using UISplitViewController in a UITabController in iPad interface


I am a new IOS developer working on my first app. I'm quite a way in to it, and have managed to get pretty much everything working how I want, but I'm chasing an odd bug.

Here's the basic app design (yes, I understand it may not confirm to Apple UI guidelines) as best I can describe it:

It's a universal app written in the latest X Code fully using storyboarding. I have a working iPhone and iPad interface, but it's in the iPad interface where my issue exists. The root controller is a UITabView. On one of the tabs, I have a split view controller which implements the typical master detail pattern. In portrait mode, the master table is hidden and content renders. A navigation bar button brings forth the master table view. You select an item and the master table view vanishes and the right side updates the content via a segue. So far so good. You rotate the device, everything keeps working. The split view master table stays on the left, and the content renders on the right. This all works great even within the tab controller.

Here are the two use cases that demonstrate the bug not happening and happening, in that order

1- Bug does not happen a) Launch app in Portrait. b) Select Nav button to bring up master table c) Select item from table (item renders, master table vanishes) d) Rotate device to lanscape (master/detail rotates properly) e) Pick a different view from tab controller f) Pick original view containing split view g) Everything is great

2- Bug happens in this use case a) Launch app in Portrait b) Select Nav button to bring up master table c) Select item from table (item renders, master table vanishes) d) Pick a different view from the tab controller e) Rotate device to landscape whilst in the other tab view f) Pick original view with the split controller from the tab bar g) View comes back, detail is rendered, master/view is completely missing.

So, it seems to be that if the master/detail rendered in landscape before the other tab view was selected, everything is fine. But if the master/detail view doesn't render in landscape at least once before you pick another view in the tab, it doesn't work right.

In my viewWillAppear method for the master/table controller, I check self.masterPopoverController.isPopoverVisible and sure enough it returns false.

I'm wondering if this is a bug, or maybe one of the reasons Apple doesn't recommend putting a split view in another controller?


Solution

  • Eventually found the answer myself.

    https://github.com/grgcombs/IntelligentSplitViewController

    This is a sub class of UISplitViewController that handles the rotations.