Reputation: 5990
I have a view in my first tab that changes data in a DatageStorageController. When I click the second tab it is supposed to show the datastorage but the view is not updated. How can I refresh the view? It is not a UITable View just a View.
Upvotes: 0
Views: 144
Reputation: 942
I think you are write code into viewDidLoad. You should write this code into viewWillAppear Which do you want to update. on ViewAppear. OR Second method you can use delegate method of tabbarcontroller
Like
With this method you can receive argument viewController which you are selected.
[viewController viewDidLoad];
It's mean you load view again. you also call [viewController viewWillAppear];
Upvotes: 1
Reputation: 3055
well, you could implement the UITabBarDelegate protocol and update your controllers view in 'tabBar:didSelectItem'. But this approach is maybe not the most clean one! The second controller should somehow be notified on data changes, so that he can update its view. Maybe take a look at KVO/KVC!
Upvotes: 0