• 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: I want a window's file owner that's not a NSWindowController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I want a window's file owner that's not a NSWindowController


  • Subject: Re: I want a window's file owner that's not a NSWindowController
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 29 Sep 2010 06:47:13 -0500

On Sep 29, 2010, at 3:21 AM, Jonny Taylor wrote:

> OK, while that's a very handy thing to know, I think I have worked out a simpler way that does not require an intermediate class - I'll state it here for the archives (and any comments welcome...)
>
> I show the window using the following code:
> @implementation Camera
> -(void)showSettingsWindow
> {
> 	if (settingsWindowController == NULL)
> 		[NSBundle loadNibNamed:@"Camera Settings" owner:self];
> 	[settingsWindowController showWindow:self];
> }
> @end
>
> ... and the NIB file (File's Owner = Camera) contains the window and a controller object (linked together), with the window controller linked to the outlet "settingsWindowController" in File's Owner placeholder.

You should be using an NSWindowController, anyway.  NSWindowController performs important services for you, like memory management of the top-level objects in the NIB and breaking retain cycles for bindings through File's Owner.  You could take care of these yourself, but it's tedious and error-prone.

http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmNibObjects.html

See the class reference for NSViewController for an oblique reference to the binding retain cycle fix in NSWindowController.

Regards,
Ken

_______________________________________________

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

References: 
 >I want a window's file owner that's not a NSWindowController (From: Jonny Taylor <email@hidden>)
 >Re: I want a window's file owner that's not a NSWindowController (From: Quincey Morris <email@hidden>)
 >Re: I want a window's file owner that's not a NSWindowController (From: Jonny Taylor <email@hidden>)
 >Re: I want a window's file owner that's not a NSWindowController (From: Jonny Taylor <email@hidden>)

  • Prev by Date: Button performs action and then stores result to a binding?
  • Next by Date: Re: Button performs action and then stores result to a binding?
  • Previous by thread: Re: I want a window's file owner that's not a NSWindowController
  • Next by thread: Tracking Area resets to view's bounds
  • Index(es):
    • Date
    • Thread