Re: Custom sheet question - which variable?
Re: Custom sheet question - which variable?
- Subject: Re: Custom sheet question - which variable?
- From: Roland King <email@hidden>
- Date: Mon, 11 Jan 2010 16:37:30 +0800
That's what I can't get to work, that's where I'm still confused. This piece
of code here:
-----------------
if (!myCustomSheet)
[NSBundle loadNibNamed: @"MyCustomSheet" owner: self];
[NSApp beginSheet: myCustomSheet
modalForWindow: window
modalDelegate: self
didEndSelector: @selector(didEndSheet:returnCode:contextInfo:)
contextInfo: nil];
----------------
I get that "myCustomSheet" is an NSWindow reference, but how does it know to
be the particular window I want to show? When the nib is loaded, where does
it go (in code)? How do I connect the window in the MyCustomSheet XIB to an
outlet in the AppDeletegate file? I am stuck there...
In your [ NSBundle loadNibNamed .. ] what's 'self' the owner you've
given it, is that your AppDelegate subclass? That's how you hook this up.
In IB you have 'Files Owner' which is going to be whatever object you
pass into the loadNibNamed call. So add an outlet to that (IBOutlet
property of type NSWindow* or similar called whatever makes sense to
you), then hook up the window in your XIB to that property of File's Owner.
Now the window is in [ self whateverPropertyYouCalledIt ] after the NIB
has loaded.
_______________________________________________
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