• 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: Dynamically loading a part of a Window in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dynamically loading a part of a Window in Cocoa


  • Subject: Re: Dynamically loading a part of a Window in Cocoa
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 1 Jul 2009 00:54:14 -0700

On Jul 1, 2009, at 00:28, Thomas Davie wrote:

On 1 Jul 2009, at 09:21, Debajit Adhikary wrote:

(Is it enough to place a generic NSView there and add a subview each time?
I'm fairly new to Cocoa, so any pointers are welcome)

Yes -- at least that's what I do, if I'm doin it rong, hopefully someone will tell me :)

As others have said, using a tabless NSTabView is generally easier, though if you need to actually release the view which isn't currently in the window, this technique doesn't do that. (Typically you don't need to release it.)


But if you are going to replace the subview "manually", the tricky part is to make sure that its nib objects are released properly, which means carefully studying the NSNib nib-loading and ownership document to decide if there's anything you need to do.

In Leopard (and the iPhone, I guess), the easier way is to use a NSViewController, because it handles nib object ownership issues for you. The view controller loads the nib for you, though you still need to swap the subviews manually.

The other advantage of NSViewController is that if your subviews each need some controller logic, it modularizes your code if you can move it to the NSViewController, instead of having to dump it all in the window controller.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Dynamically loading a part of a Window in Cocoa
      • From: "Adam R. Maxwell" <email@hidden>
References: 
 >Dynamically loading a part of a Window in Cocoa (From: Debajit Adhikary <email@hidden>)
 >Re: Dynamically loading a part of a Window in Cocoa (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: Dynamically loading a part of a Window in Cocoa
  • Next by Date: Re: Drawing the background of a single row in NSTableView
  • Previous by thread: Re: Dynamically loading a part of a Window in Cocoa
  • Next by thread: Re: Dynamically loading a part of a Window in Cocoa
  • Index(es):
    • Date
    • Thread