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

viewDidLoad is called on application start, but should be called on tab activation #373

Closed
bugzhunter opened this issue Jun 16, 2015 · 5 comments

Comments

@bugzhunter
Copy link

When UIStoryboard.initialViewController is UITabBarController, Typhoon runs through all childViewControllers and indirectly calls viewDidLoad in all these view controllers. It's happening on the start of an application, but default behaviour is to receive viewDidLoad on first tab activation.

Here is gist with code from Typhoon that cause such behaviour https://gist.github.com/anonymous/2b6573c18e711888ced8#file-gistfile1-m-L10-L16

@alexgarbarev
Copy link
Contributor

@bugzhunter Yes, I know the reason of that error... It's because of PR: #350 - It tries to inject properties into UIViews, so views are mistakely loaded on viewController.view getter.

Have you ideas how to fix your problem and keep this PR working? If I'll come up with something good, this problem would be fixed asap

@bugzhunter
Copy link
Author

What drawbacks would have something like this? https://gist.github.com/bugzhunter/a6e0090469243c98b6f2#file-gistfile1-m-L14-L21

@alexgarbarev
Copy link
Contributor

The problem here: if view is not loaded (which is always true at this stage), properties will not be injected into UIView, because this code called once, after UIVIewController created.

The correct solution is: try to inject properties into view, after it's loaded. (i.e. after viewDidLoad). Right now I think only option is to use method swizzling and replace viewDidLoad with another which will post notification or call notification block.

@alexgarbarev
Copy link
Contributor

@bugzhunter, Fixed in 3.2.0

@bugzhunter
Copy link
Author

Kudos!

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