Re: Correct use of NSViewController

2008-03-21 Thread Cathy Shive
It's so interesting to me to see different people's way of dealing with this. Seems like everyone's design is very similar - they just differ in the implementation details. I hope Apple will fill in the blanks in the framework eventually. We have all come to the same solution in a certain

Re: Correct use of NSViewController

2008-03-21 Thread Steve Weller
On Mar 21, 2008, at 2:31 PM, Cathy Shive wrote: 1, window is about to close (wish there was a more reliable place to do this, but it has to be before dealloc): windowController: - (void)windowWillClose { [mViewController removeObservations]; // this causes the method to be called all the

Re: Correct use of NSViewController

2008-03-21 Thread Steve Weller
I'm going down this same path I think. I have a split view with a browser and a document. The way I solve it is to have the window controller have outlets to the scroll views of the two panes of the split view. Then in the window controller I do this: - (void)windowDidLoad { [super wi

Re: Correct use of NSViewController

2008-03-21 Thread Cathy Shive
Yeah, this is something I ran into dealing with the fact that I have several key value observations set up. The way I deal with it is to give my view controller's abstract superclass a -(void) removeObservations method. I set it up to work similarly to how you use the -(void)dealloc method

Re: Correct use of NSViewController

2008-03-21 Thread Jonathan Dann
Hi Cathy and Paul, Thanks to you both for your help, I'm really starting to get somewhere with this now. I now have a view controller hierarchy that reflects the views in my app. I've defined my own view controller subclass that I use and an abstract superclass for the view controllers I

Re: Correct use of NSViewController

2008-03-20 Thread Paul Szego
On 21/03/2008, at 12:35 AM, Jonathan Dann wrote: Hi Cathy, Thanks again for your advice. I've got it working now and I'm almost back I where I was before refactoring, I'm now running into a bindings problem. Before using the view controllers I had put 2 tree controllers in my window

Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive
Yeah, the document. The window controller and document have a relationship, but this isn't true for the view controllers and the document. Again, this is part of NSViewController's ambiguous role in this whole architecture. I don't really know how this *should* be dealt with. It seems

Re: Correct use of NSViewController

2008-03-20 Thread Jonathan Dann
Hi Cathy, Thanks again for your advice. I've got it working now and I'm almost back I where I was before refactoring, I'm now running into a bindings problem. Before using the view controllers I had put 2 tree controllers in my window controller's nib, 2 outline views were then bound to

Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive
Jonathan, I just wanted to say one more thing. I was re-reading what you had written and I see the problem you're having with setting up the frame for that first split view. The problem isn't just the set up of your view controllers and the order of creating/adding views, you're also dea

Re: Correct use of NSViewController

2008-03-20 Thread Cathy Shive
I would do it exactly like you described. Seems to me that your instincts are pretty much on the mark. In your case, the window controller could take care of creating that first main split view, but I would do it in the first level of the view controller controller tree for logical consi

Re: Correct use of NSViewController

2008-03-19 Thread Jonathan Dann
Hi Cathy, Thanks for the comprehensive answer to my question, I wanted to make sure that I wasn't committing heresy by going down the 'tree of view controllers' road before jumping in and refactoring all my code. I was hoping to set it up so I could forget about most of the memory manage

Re: Correct use of NSViewController

2008-03-19 Thread Cathy Shive
Hi, My strategy is similar to yours, but it doesn't have to result in spaghetti code. I have a view controller class that contains a list of sub-viewcontrollers. What I end up with is a structure that does in fact resemble the actual view hierarchy. The tricky part is breaking down your

Correct use of NSViewController

2008-03-19 Thread Jonathan Dann
Hi guys, I've ended up with a bloated window controller in my document based app and want to refactor my code using done view controllers. My question is really about design. If I have a split view with which contains a split view (like mail) then should I have a controller for the large