• 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 -addSubview tutorial or example?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView -addSubview tutorial or example?


  • Subject: Re: NSView -addSubview tutorial or example?
  • From: Chris Hanson <email@hidden>
  • Date: Sat, 20 Mar 2004 16:31:51 -0500

On Mar 18, 2004, at 2:04 PM, Philip Riggs wrote:
Can anybody point me to a tutorial or example using the NSView -addSubview method?

I don't have a pointer to a tutorial or example, but it should be very easy to put one together. One of the things I love about Cocoa is that it's very easy to put together a simple single-window application to explore concepts.

If I were trying to figure this out, here's what I'd probably do: Put together a single-window app whose window contains a button and a box. When the button is clicked, load a nib file containing a view with a static text field inside it. Then add the loaded view as a subview of the box.

What I would like to do is add a series of floating NSTableViews to make a database relationship view where the tableviews have columns of key, table fields, etc. and the user can draw relationship connections between tableview cells using lines. NSTableView seemed like the easiest way to do this.

This is one way to do it. You might have to do a bit of subclassing and overriding to get the dragging behavior to work the way you want it. It might just be easier to create your own views to draw into; drawing a grid of data is pretty straightforward.

Also, can I design a view in IB and add it as a subview to my relationship view?

Certainly. You can just drag the Custom View object out of the Containers tab in the Interface Builder palette straight to your nib file. It'll show up in a window, but it'll be a plain NSView at the top level of your nib file.

-- Chris

--
Chris Hanson
Email: email@hidden
Weblog: http://www.livejournal.com/users/chanson/
_______________________________________________
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.


References: 
 >NSView -addSubview tutorial or example? (From: Philip Riggs <email@hidden>)

  • Prev by Date: NSKeyedUnarchiver replaces NSStrings
  • Next by Date: Most commercial, shareware apps leak memory?
  • Previous by thread: Re: NSView -addSubview tutorial or example?
  • Next by thread: looking for user interface consultant
  • Index(es):
    • Date
    • Thread