开发者

uinavigationcontroller updating previous view when popping back

I have a UINavigationController and I go from Level1 to Level2 where I select a row/item ; and then I go back using the back button - BUT - in my level 1 I was displaying a default selection (which I changed by going to Level2 and select something else) - and my level 1 does not change at all so I guess that the viewDidLoad is not called again... how do I force it to reload?

Thanks a lot

Cheers geebee

EDIT1: i know you are right but it didn't work - I was aksing myse开发者_如何学Clf if it has to do with all the stuff about re-usable cells and so it does not reload... is that possible? any more ideas

EDIT2: in fact, it didn't work means that I copied all the code (I moved it in fact) from didLoad to viewWillAppear - was that the right thing to do? or should have tried to update my nsmutablearray at the right place? Thanks. Cheers

edit 3: in fact, putting some more flags/messages in my code to understand what is going on, although viewWillAppear is called when re-displayed, the visible cells are not "repainted/refreshed". as such if I scroll down then up, magically the changes are working and appear BUT I would like this to happen right from the start. any idea please help. thanks


-viewDidLoad is called only once during the lifetime of a UIViewController. It is called right after the view controller's view is requested, such as by accessing its view property. Therefore, in your case you want to put your reloading code in -viewWillAppear:. This method is called every time your view controller's view is displayed.


You can put your updating code to controller's -viewWillAppear: method


But -viewWillAppear is not called in ios 4.3, it does get called in ios 5.0 and up

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜