I am cleaning up my iphone application and, in doing so, realized that i am inconsistent with assign/retain when it comes to UIViewController.
I use assign to reference the parent view within the child view. Is this wise?
I guess the parent rarely needs a reference to the child viewcontroller…so that direction is easier to understand. (don’t keep a reference)
… well, I’s say, it depends …
If you just assign the parent view, it might happen that the view is being released (when the reference count of it falls to 0 because somewhere else the last reference to it is freed – or it happens to be an autoreleased object). Thus, if you rely on having the parent object to exist for some reason (need to access data or send messages to it), it’s better to retain (and release it). So you’re always sure the parent exists.