Why is shouldHideViewController called but not willHideViewController?

1.1k Views Asked by At

I'm trying to implement a UISplitViewController which has different UIDetailViewControllers. I've created a delegate that all the detail views implement. It only has a UIBarButtonItem which is the button used to access the master view in portrait mode. All works well with one exception: when I replace the detail view controller, the button doesn't appear. In my master view controller, which is where I implement the UISplitViewControllerDelegate, the shouldHideViewController is called but the willHideViewController isn't. I checked that the shouldHideViewController returns YES. Any idea of what could make the shouldHideViewController being called but not the willHideViewController? Shouldn't they always be called together, if the first one returns YES? If I rotate the device after replacing the detail view, everything works fine.

1

There are 1 best solutions below

1
John67 On

Did you set the delegate in awakeFromNib: or viewDidLoad: ?

If you set in viewDidLoad - your delegate won't be set when in storyboard