Re: Bindings and MVC
Steve Nicholson <[email protected]> Tue, 11 Jan 2011 16:50:19 -0800
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
Thanks, Erik. I wrote this program while I was learning Cocoa concepts. Now I realize I also included my window controller in the class. I have a lot of refactoring ahead of me. -Steve On Jan 11, 2011, at 3:25 PM, Erik Buck wrote: > See NSObjectController. > > NSObjectController *myController; > > Bind myController's content to a model object or use -setContent or initWithContent. > > In IB, > bind things to myController.selection.<someProperty> > > If your model has array or dictionary semantics, consider NSArrayController or NSTreeController > > On Jan 11, 2011, at 3:15 PM, Steve Nicholson wrote: > >> I have a program I wrote a few years ago in which I was a bad programmer and implemented my model and controller in the same class. Now I'm trying to extract the model from the controller and put each into its own class. I have fields in my NIB bound to properties in the controller. Should I change them to be bound to the model or keep them bound to the controller and have pass-through setters and getters from the controller to the model? >> >> The former seems to break the model-view-controller separation, but the latter is a whole lot of what seems like redundant code. >> >> Thanks for any insights, >> -Steve >> _______________________________________________ >> MacOSX-dev mailing list >> [email protected] >> http://www.omnigroup.com/mailman/listinfo/macosx-dev >