• 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: Custom sheet question - which variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Custom sheet question - which variable?
      • From: Jenny M <email@hidden>
References: 
 >Re: Custom sheet question - which variable? (From: Jenny M <email@hidden>)

  • Prev by Date: Re: Custom sheet question - which variable?
  • Next by Date: Re: How to know whether property in Cocoa class is KVO-compliant?
  • Previous by thread: Re: Custom sheet question - which variable?
  • Next by thread: Re: Custom sheet question - which variable?
  • Index(es):
    • Date
    • Thread