• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSView subclasses and app design
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView subclasses and app design


  • Subject: Re: NSView subclasses and app design
  • From: Brian Webster <email@hidden>
  • Date: Tue, 9 Jul 2002 21:15:19 -0500

On Tuesday, July 9, 2002, at 08:52 PM, cocoa-dev-
email@hidden wrote:

I have a fairly complicated view I'm building made up of a couple
matrixes and a few NSButtons, and have some questions about the general
design patters of NSView subclasses and Cocoa.

There are really two options I see for setting up this view:
a) I create a NSView subclass to tie them together. I add the
NSMatrixes and NSButtons as subviews, and handle a bit of extra drawing
(such as borders and such), plus making sure everything stays in the
right place when the user resizes the window (Simple IB springs won't
work here).

b) Try and do everything above (except the drawing? make more views for
this) in a seperate non-NSView controller class.

Is there a single customary or suggested way of doing this kind of thing
in cocoa?

I would go for option (a). You can make a subclass and simply override resizeSubviewsWithOldSize: to handle your custom resizing behavior, and the stuff in between the views can be handled easily by implementing drawRect:. Doing it with an external controller would be a royal pain without a whole lot of benefit.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: "Morphing" Sheets
  • Next by Date: Re: Database Suggestions
  • Previous by thread: NSView subclasses and app design
  • Next by thread: Closing an NSConnection
  • Index(es):
    • Date
    • Thread