I am learning to develop iOS application and currently i have 4 view controllers.
In the first viewController i have used the method viewWillTransition to adjust UI at the runtime.
Again in the 4th ViewController i am trying to use the method viewWillTransition, but it is not getting called there.
And when i did comment the method (viewWillTransition) in first controller it magically started to be working in fourth viewController. So i came to the conclusion that viewWillTransition can only be implemented in only one viewController But i need to use it in multiple places.
What is the work around ? How can i fix it ? I am using Swift4 and Xcode9.
Just reposting my comment as an answer,
You must call
supersomewhere in the implementation of yourviewWillTransition(to: with:). Usually it is the first line.It should look something like this:
This will allow the superview to pass this method class to all of its subviews. So if you have a
UIViewControllerinside aUITabBarController, calling this method on super will allow all the other tabs to receive this method call.