Search code examples
objective-cuitabbar

tabbar. switching between uiviewcontroller with event


I have tabbar application. There are 5 tabbar items with 5 uiviewcontrollers for each one. UIViewControllers are without xib files. I can switch between them, but i need to do some action on switching. Is there some event for this action?


Solution

  • in all the view controllers, the following method will be called when you switch to that specific view controller.

     // inYourViewController.m file
     - (void) viewWillAppear:(BOOL)animated
     {
        //insert your code here
        //EDIT
        [super viewWillAppear:YES];
     }