romaonthego / RESideMenu

iOS 7/8 style side menu with parallax effect.
MIT License
7.1k stars 1.35k forks source link

Use appearance transition methods on menu view controllers so that view events are sent #227

Closed airdrummingfool closed 9 years ago

airdrummingfool commented 9 years ago

This is an attempt at a fix for #174. Using beginAppearanceTransition:animated: and endAppearanceTransition ensure that the menu view controller's viewWillAppear:, viewDidAppear:, viewWillDisappear:, and viewDidDisappear: are messaged.

From the documentation regarding appearance transition methods:

Discussion

If you are implementing a custom container controller, use this method to tell the child that its views are about to appear or disappear. Do not invoke viewWillAppear:, viewWillDisappear:, viewDidAppear:, or viewDidDisappear: directly.

I'm not super familiar with RESideMenu, so there may be a better place for some of these calls. In my testing, the proper view events are always sent when a menu view controller is coming into/going out of view, but there are times when the menu view controller may not be on screen that a view event is still fired (e.g. if hideMenuViewControllerAnimated: is messaged when neither menu view controller is visible, which is currently allowed by RESideMenu).

This does not add any appearance transition calls for the content view controller, where the view never fully leaves the screen (and thus, arguably, does not "disappear").