Hi,
I have read the documentation about the use of the viewDidUnload method. I thought I did understand the meaning of this method, but after reading some more about it, I do feel confused. Is this the correct way to do this?
1) I use retain with @propery in the .h file and @syntesize in the .m-file. I assign object with a value using self.object = something. In this case I would set self.object = nil; in the viewDidUnload method.
2) I do not retain the object in the .h-file but I am allocing and init the object in the viewDidLoad method. In the dealloc method I have the [object release]; In the viewDidUnload method I also set [object release]; because the next time the view will appear, the object will be created in the viewDidLoad method
3) What about IBOutlet objects also being retained by @property? Usually IBOutlet objects should be set to nil in the viewDidUnload method, right? Should they also be set to nil in the dealloc method?
I got confused basically about releasing in the viewDidUnload and where to set objects to nil in the dealloc method. I have read alot posts/blogs etc where people say that release should not be done in the viewDidUnload method.
Thanks in advance for helping me clear those things up!
MACloop
I have read the documentation about the use of the viewDidUnload method. I thought I did understand the meaning of this method, but after reading some more about it, I do feel confused. Is this the correct way to do this?
1) I use retain with @propery in the .h file and @syntesize in the .m-file. I assign object with a value using self.object = something. In this case I would set self.object = nil; in the viewDidUnload method.
2) I do not retain the object in the .h-file but I am allocing and init the object in the viewDidLoad method. In the dealloc method I have the [object release]; In the viewDidUnload method I also set [object release]; because the next time the view will appear, the object will be created in the viewDidLoad method
3) What about IBOutlet objects also being retained by @property? Usually IBOutlet objects should be set to nil in the viewDidUnload method, right? Should they also be set to nil in the dealloc method?
I got confused basically about releasing in the viewDidUnload and where to set objects to nil in the dealloc method. I have read alot posts/blogs etc where people say that release should not be done in the viewDidUnload method.
Thanks in advance for helping me clear those things up!
MACloop