I often have a view controller that displays a view associated with a model 
object. So, I'll have a foo property on that VC, and in the prepareForSegue 
call that presents the VC, I'll setFoo on it.

In my -setFoo: method, I set up KVO on the properties of the foo that I'm 
interested in displaying. In the -observe... method, I update the various bits 
of UI as properties change.

This generally works very well, except when I get to the VC via a segue. 
-prepareForSegue gets called before -viewDidLoad, so none of the IBOutlets 
exist yet.

I can solve this by doing an explicit UI update step in -viewDidLoad, but that 
ends up effectively duplicating the UI update code.

I can load the view in -setFoo: by referencing self.view, but this seems like a 
hack.

What are other people doing to address this? Any "best practice" you guys like?

-- 
Rick




_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to