Re: Beginner pleads for help...
Re: Beginner pleads for help...
- Subject: Re: Beginner pleads for help...
- From: Eric Peyton <email@hidden>
- Date: Wed, 4 Jul 2001 09:20:52 -0500
Take a look at Fire.app. Almost every window is it's own nib and
loads it and displays it just like you want.
Basically - here it goes.
Create a nib file. Call it Foo.nib. Add it to your project.
Create a class (subclass of NSObject) in the nib file call Foo.
Create your accessors and your actions and draw the UI. Hook them
together. Then use IB to generate your class for you. It will
create a filled out .h and .m in your project.
Then in Foo's code - add something like this ...
- (id)init
{
self = [super init];
[NSBundle loadNibNamed:@"Foo.nib" owner:self];
return self;
}
Voila. You are done. Now when you create a new instance of Foo,
it will load the nib. You will need to add in code to show the
window and yadda yadda yadda and dealloc stuff later yadda yadda,
etc.
It's all real easy - once you know how :-)
Eric
On Wednesday, July 4, 2001, at 07:00 AM, Steve Woodward wrote:
Sorry to have to ask, but this one thing has been driving me
crazy. I'm trying to learn how to create and show a second window
from a "main" window. I've looked at the ToDo example in "Learning
Cocoa" as well as the SimpleMultiWindow example. The
SimpleMultiWindow really throws me off, they subclass
NSApplication instead of NSObject (which I've been doing all
along), then for the second window they subclass
NSWindowController but never instantiate it...it seems to me that
the confusion lies in the IB connections to File's owner and to
the delegate. I had hoped that you would simply create a new nib
file, then load that nib file at run time and show the window. I'm
obviously missing something rather basic here, and would be
greatly appreciative of any advice from anybody! Many thanks in
advance.
Steve W
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev