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

drawerController is null in viewWillDisappear and viewDidDisappear #21

Closed
Serproger opened this issue Apr 6, 2018 · 12 comments
Closed

Comments

@Serproger
Copy link

Serproger commented Apr 6, 2018

Extension property drawerController of UIViewController returns nil when I'm trying to access it in viewWillDisappear and viewDidDisappear methods of my view controller. Could you please explain this behaviour if it's correct or fix it if there is some bug?

@kawoou
Copy link
Owner

kawoou commented Apr 17, 2018

The situation is not reproduced. Can you tell me what circumstances?

@Serproger
Copy link
Author

This issue can be observed when UINavigationController is located inside DrawerController, I have controllers A and B in navigation stack and I press back button in B. ViewWillDisappear and ViewDidDisappear of B will be called, but in both of them drawerController property is equal to nil. If necessary, I'll prepare sample project.

@Serproger
Copy link
Author

UPD. Sorry, in this case the problem doesn't reproduce. I'll prepare another sample sample.

@kawoou
Copy link
Owner

kawoou commented Apr 17, 2018

If that's what I understand:

DrawerController <- UINavigationController
  UINavigationController <- A
  UINavigationController <- B

Since A and B are not managed directly by DrawerController, nil value is correct.

However, the drawerController property of the UINavigationController will be not nil.

@Serproger
Copy link
Author

But in other lifecycle methods drawerController is not nil...

@kawoou
Copy link
Owner

kawoou commented Apr 17, 2018

What is "other lifecycle"?

@Serproger
Copy link
Author

Serproger commented Apr 17, 2018

for example, viewDidLoad.

@kawoou
Copy link
Owner

kawoou commented Apr 17, 2018

I extended the range of drawerController property. #25
Is there a problem now?

@Serproger
Copy link
Author

drawertest1.zip

Please see controller InnerContentController1 in this sample. drawerController is not nil in viewWillDisappear but it is nil in viewDidDisappear.

@Serproger
Copy link
Author

You should press button "GO", then button "Button", then press back button in navigation controller to reproduce.

@kawoou
Copy link
Owner

kawoou commented Apr 18, 2018

I have tested the code.
In viewDidDisappear, it is normal for the drawerController variable to be nil.
Because there is no parentViewController at the time when viewDidDisappear is called.

@Serproger
Copy link
Author

OK, maybe it's the feature, not bug :)

Please update package in Cocoapods.

@kawoou kawoou closed this as completed Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants