Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for setting view controllers twice during state restoration. #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

AndriyGo
Copy link

@AndriyGo AndriyGo commented Jun 2, 2014

Introduced changes in the decodeRestorableStateWithCoder method so that during state restoration left/center/right controllers are not reassigned if they are already assigned by user

Introduced changes in the decodeRestorableStateWithCoder method so that during state restoration left/center/right controllers are not reassigned if they are already assigned by user
@kcharwood kcharwood added the bug label Mar 11, 2015
@kcharwood kcharwood added this to the 0.6.0 milestone Mar 11, 2015
@kcharwood kcharwood changed the title Update MMDrawerController.m Fix for setting view controllers twice during view restoration. Mar 11, 2015
@kcharwood kcharwood changed the title Fix for setting view controllers twice during view restoration. Fix for setting view controllers twice during state restoration. Mar 11, 2015
@kcharwood
Copy link
Contributor

Just now getting around to this. I'm actually a bit concerned with this PR. If the drawer controllers and center controller are not nil, why would we even be in this method. I'm wondering if there is potentially a bug elsewhere.

@AndriyGo
Copy link
Author

AndriyGo commented Apr 1, 2015

I am not sure that this is a bug. In my app I am assigning the MMDrawerController as the rootViewController in willFinishLaunchinWithOptions:. I am also creating the left controller (which is a menu and doesn't change) and a centre controller (which is a UINavigationController). I then have a method viewControllerWithRestorationIdentifierPath: where I do return the MMDrawerController and other created controllers for the appropriate restorationIdentifier keys. So, the fact that decodeRestorableStateWithCoder: is called on MMDrawerController seems to me like a correct behaviour (after all I do want it to restore the open state of the drawer and other things).

Basically, I have the same behaviour as in KitchenSink where controllers are also created and then returned in the viewControllerWithRestorationIdentifierPath: . And it looks like being in the decodeRestorableStateWithCoder: on MMDrawerController is correct in this case.

Either we shouldn't be restoring child controllers in decodeRestorableStateWithCoder: or we should not be creating those controllers ourselves. I don't remember if I tried the later approach to confirm that it works or not.

@kcharwood kcharwood removed this from the 0.6.0 milestone Apr 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants