views:

116

answers:

1

Hi guys,

In my tab-bar I have four viewcontrollers, and what happens in one can affect the view of the other, so I may need to reload some elements in the viewcontroller when it becomes visible. Normally I'd fix that by implementing viewWillAppear, but when I switch between the tabs, viewWillAppear does not seem to get called. How can I fix that, or what should I do instead?

Update: as a PS I should add that this is a tabbarcontroller in a navigationcontroller hierarchy

Cheers

Nik

A: 

viewWillAppear sould only be used when the view appears, and not for updating it.

use setNeedsDisplay on the viewcontroller's view instead.

tadej5553
Where would I call setNeedsDisplay from? The problem is that I need a hook for when the user chooses a new viewcontroller from the tabbar
niklassaers
Oh, sory, I mixed up things here a little bit.I'm not sure why the viewWillAppear is not getting called, but I know a way around it:Make some object a tabBarController delegate, and it will the send the message, that a new view was selected, and call view will appear from there.
tadej5553
Sounds like an interesting idea, I'll give that a try tomorrow :-)
niklassaers