I'm seeing the same behaviour and agree it is less than ideal.
The fundamental issue here is that the same UICollectionView
instance is shared/passed between the two view controllers. I experimented with trying to change the delegate and datasource of the UICollectionView
but ran into various problems.
In the end, the solution I ended up adopting was to make the master UICollectionViewController
a delegate of the UINavigationController
, implementing:
– navigationController:willShowViewController:animated:
...using this to switch a controllerMode
property and then adding switch statements to -collectionView:cellForItemAtIndexPath:
and -collectionView:didSelectItemAtIndexPath:
to provide the required behaviour in the mode. I also added code to -setControllerMode:
to do any required state changes in the master view controller.
Hope that helps!