views:

144

answers:

2

Hi!

Some important part of my code is running in viewDidLoad and I was wondering is there was a way to unload an UIView so that when my controller calls it again it must go through viewDidLoad again?

Thanks a lot!

+2  A: 

Put those important part of code into -viewWillAppear:. -viewDidLoad is meant for initialization only.


You can also manually call -viewDidLoad or set the view property to nil.

KennyTM
Hum viewWillAppear gets called only once as well... Tell me if I'm wrong...
Tom
@Tom: `viewWillAppear:` will be called when the view controller *appears*. How often do you want it to be called?
KennyTM
@KennyTM: For some reason my viewWillAppear only gets called once. Is there a way to unload a view?
Tom
@Tom: Please show us how you implement it.
KennyTM
+3  A: 

You should perhaps rethink the positioning of that code if its important.

If you need it to run each time the view is displayed, consider placing it in view[Will/Did]Appear.

Jasarien