Jonas Arcangel
Jonas Arcangel

Reputation: 1925

What Method to Override when View goes Active?

I have a Tab Bar Controller that contains five views. The views have elements that update a variable in the root app delegate. I'd like the views to change whenever this variable changes value.

In the absence of an event notification mechanism to update all views, I'd like them to update when they are displayed (ie., when their tab bar button is pressed.)

What method should I override? I thought it was viewDidLoad but I realize this is being called only once, and when I go to another view, make a change, and go back to it, nothing happens.

Upvotes: 1

Views: 831

Answers (1)

Martin Babacaev
Martin Babacaev

Reputation: 6280

Try one of these

- (void)viewWillAppear:(BOOL)animated

- (void)viewDidAppear:(BOOL)animated

They will handle events just before and after a view of corresponding view controller will become visible.

Upvotes: 2

Related Questions