1

I got TabBar Application with 3 ViewControllers. Can i know from the ViewControllers's method which ViewContoller was desplayed before (1 or 2)? Or maybe i open VeiwController from some other .xib

Eugene Trapeznikov
  • 3,220
  • 6
  • 47
  • 74

2 Answers2

3

You can do this by implementing UITabBarController delegate method -

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
{
}

in this you can check for [tabBarController selectedViewController] , here selectedViewController is the view controller which is currently selected and viewController is which is going to be selected.

saadnib
  • 11,145
  • 2
  • 33
  • 54
1

I just creating @property in target VeiwController and set this @property firstly in viewDidLoad. So i know that firstly this ViewController will appear from TabBar. After that i can change it in some other ViewController's methods, which call some subviews (.xib).

Eugene Trapeznikov
  • 3,220
  • 6
  • 47
  • 74