On Jun 8, 2014, at 12:07 PM, Miguel Carvajal <krvajal.miguelan...@gmail.com> 
wrote:

> I created a new NSWindow in interface builder and using a
> NSWindowController i pr ogrammatically load the window from the nib and
> show it, but once i close the window, i don' t get it show again. Some
> digging in stackoverflow revealed me that it happens that way because i
> have to set the File's Owner of the NSWindow in IB to NSWindowsController.

Whether a window will appear or not has nothing to do with File's Owner. Your 
window is probably marked as "Release When Closed" in IB. It's shown once the 
first time, but after closing it it's deallocated and no longer exists so it 
can't be shown a second time. Turn that off.



Documentation on File's Owner:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html


In this case File's Owner is the NSWindowController because it's the 
NSWindowController that is loading and "owns" the nib. 

When you load a nib, your code needs to access certain objects in the nib (via 
IBOutlets) and your nib may need to set properties (like delegates, data 
sources, and actions) to objects that exist outside of the nib. When you 
connect to "File's Owner", you're connecting from an object in IB to that 
object that already exists before nib is loaded. When you connect from "File's 
Owner" to an object in the nib, you're setting an outlet in that already 
existing object to an object in the nib that's being loaded.


--
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