mattgemmell/MGSplitViewController — Issue #53: Initial load of masterView is too tall
Author: PDay9
Created: 2012-01-18 17:20:34+00:00
State: open

My hierarchy consists of a UINavigationController which contains the MGSplitViewController and then inside the MGSplitViewController I have another UINavigationController in the masterView and a UIViewController in the detailView. Then inside the second UINavigationController I have a series of UITableViews.

Whenever I display the first UITableView, whenever I'm in landscape, the UITableView is 44px too tall (the height of a navigation bar). If I change orientations and change back, the view renders correctly.

What I have found out, is that [MGSplitViewController splitViewSizeForOrientation:] returns the correct size every time, but if print out the actual height of the UITableView after it loads (or changes orientation) the height is incorrect by 44px on load. On load the UITableView is 748px tall but after an orientation change it is 704px tall for landscape.

I've tried loading the second UINavigationController on its own and I've tried loading the first UITableView without the UINavigationController, and I've tried just loading the UITableView on its own. As soon as I remove MGSplitViewController from the hierarchy everything renders correctly.

So far my workaround has been to just keep track of the first time [MGSplitViewController layoutSubviewsForInterfaceOrientation:withAnimation:] and subtract the height of the navigation bar from the masterView, if it's in landscape orientation, otherwise calculate the dimensions normally.