Re: Linking an NSWindow in IB
Re: Linking an NSWindow in IB
- Subject: Re: Linking an NSWindow in IB
- From: Jens Alfke <email@hidden>
- Date: Wed, 31 Aug 2011 20:04:30 -0700
MYWindow isn’t a window, it’s an NSObject that can act as a window delegate. So creating one isn’t going to create a window. You don’t have any code that creates a window; there’s a window property but nothing that sets it. Also, you’re calling a -showWindow: method on your MyWindow class, but you never defined or implemented such a method.
What you want to do is
- Add a window to your main nib/xib file.
- Add a MyWindow object too (drag in a generic object and set its class to MyWindow)
- Wire the window up to the MyWindow (control-drag from MyWindow to the NSWindow and select the “window” outlet)
- Create another IBOutlet variable in your app delegate’s class, of type MyWindow* … let’s say it’s named myWindow.
- Wire that up to the MyWindow object in the nib.
- Now to display the window your app delegate calls [[myWindow window] makeKeyAndOrderFront: self]
I haven’t looked at the tutorials and intro docs in a while, but there must be some that cover this stuff.
—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