On Sep 5, 2012, at 5:39 AM, Jerry Krinock wrote:

> … except that my window controller for this multi-tabbed window is already 
> huge.

In a complex window where there a multiple tabbed views like you have, think of 
the window controller as doing nothing more than managing the view controllers 
for each of the tabs, not the actual views in each tab. If your window 
controller is getting monolithic, it's time for a refactor.


For example:
http://araelium.com/querious/screenshots/query_75p.png


(Ignoring the affects of having literal tabs in this window…) Each view up in 
the toolbar is a separate view controller, which is possibly composed of one or 
more child view controllers. In this particular screenshot, you're looking at 
four. The window controller has a piddly 600 lines of code in it which is 
merely for creating and swapping out views of the top level view controllers, 
etc. The real work is all done in a tree of view controllers.


There's a view controller responsible for doing nothing more than managing the 
table view displaying the query results table, and basically has this interface:


@interface ResultListViewController : NSViewController {
        NSTableView * resultListTableView;
        NSArrayController * resultListArrayController;
}

@property (readwrite, retain) NSArray * results;

@end



The view controller is the delegate and data source for the table view and 
manages a bunch of little things related to the table.




--
Seth Willits





_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to