Say I have a FooController
subclass of UIViewController
that displays a list of Foo
s. What's the best practice for dealing with my foo
property's lifecycle?
Do I define the @property
as being read/write? It's not really -- once it's been set, changing it would potentially result in inconsistent state. Do I create the @property
as readonly
and write a new designated initializer, initWithFoo:(Foo *) aFoo
that calls initWithNibName:bundle:
? Now I have to create a new instance every time the controller is popped off the stack, and pushed on with a new foo
.
The latter seems to me like the approach to take, but I've never seen anyone do this. So what's standard practice?