I created a project using tabbar apllication and storyboard.
Now i have FirstViewController (which is selected by default) and SecondViewController.
How do i catch the moment when the selected view controller changes? (the user selects second view controller on tabbar).
The only way i thought of is: 1. Make a property for UITabBarController in appDelegate.
Set it using
self.tabBarController = (UITabBarController *)self.window.rootViewController
Make the first view controller conform to UITabBarControllerDelegate.
Set the tabbar's delegate to FirstViewController using
[[UIApplication sharedApplication] delegate]
Is there a simpler and cleaner way to do this?