0

When I switch tabs in my tab bar application, one of my views needs to update because the user may have changed a preference that affects it. It is a UIViewController's view, but when the views switch, the viewDidLoad/Appear methods aren't called. Can this be solved using an NSNotification or any other way? Please give example code, especially for NSNotifications, as I am new to them.

4
  • Why aren't they getting called? Are you using a UITabBarController object or just a UITabBar? May 27, 2011 at 18:34
  • The entire app runs on the UITabBarController but the view I am talking about is a subview of one of the tabs. I just want to know how to make it update when the tabs are switched. May 27, 2011 at 18:36
  • So it is [tabBarController]->[viewController]->[view]->[yourView](which is controlled by a view controller). Have I got the path right? May 27, 2011 at 18:44
  • yes, only there is one more view and view controller after the first view controller and view May 27, 2011 at 18:47

2 Answers 2

5

You might want to peek at UITabBarControllerDelegate and tabBarController:didSelectViewController:. There you can determine how to handle the view change and whether you need to update the view based on the possible preference change.

0
1

tabBarController:didSelectViewController: you can implement this method in the appdelegate. you will get the sxact root view controller at which yopu clicked . then you can update that view .

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.