views:

27

answers:

1

I have a application with many views. For example, I have "A", "B", "C".... Both "A", "B" have a button to switch to "C". Also, I can click the tabbar "C" item to switch to "C". The question is, when I tab the tabbar to switch "C" is different from "B" and "A".

For example, if I click the A view's button, it will switch to "C", and the background color is red. if I click the B view's button, the color will become blue. But when I click on the tabbar, I want to color is yellow. So, I need to know, which class is calling the "C" view to display. What should I do? Thank you.

A: 
  1. Within tab bar item controller you can switch self.navigationController.tabBarController.selectedIndex
  2. Within tab bar controller delegate you can send a message to selected view controller by tabBarController:didSelectViewController
NR4TR