• 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: Linking an NSWindow in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking an NSWindow in IB


  • Subject: Re: Linking an NSWindow in IB
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 31 Aug 2011 00:05:24 -0700

On Aug 30, 2011, at 10:30 PM, Guy Halford-Thompson wrote:

> I have created the window in IB and also created a custom class
> (MyWindow).  in IB I have given the window class MyWindow.
>
> I have added a couple of extra functions to MyWindow and now I wish to
> trigger the window to be displayed given certain conditions.
>
> How can I display the window?

You need to know which object is being called when the condition is met, and that object has to have a pointer to your window so it can call it. Generally you’d wire a connection in Interface Builder from that object to your window, so the object will have an instance variable pointing to the window.

In a simple app the object that’s doing stuff is most likely the application delegate object, so you’d add an instance variable of type MYWindow*, put the IBOutlet keyword on it so IB knows it can be wired to, and then control-drag a connection from the window to the app delegate. Now when a method of the app delegate is called (like some menu-triggered action) it can use that instance variable to call the window.

—Jens_______________________________________________

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: 
 >Linking an NSWindow in IB (From: Guy Halford-Thompson <email@hidden>)

  • Prev by Date: Re: Large over 100K pixel high ruler scroll view
  • Next by Date: Re: LLVM 2.1 Error
  • Previous by thread: Linking an NSWindow in IB
  • Next by thread: Re: Linking an NSWindow in IB
  • Index(es):
    • Date
    • Thread