• 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: Beginner pleads for help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Beginner pleads for help... (From: Steve Woodward <email@hidden>)

  • Prev by Date: Re: Beginner pleads for help...
  • Next by Date: Re: Delegate versus Controller
  • Previous by thread: Re: Beginner pleads for help...
  • Next by thread: [ANN] Vermont Recipes disk images fixed
  • Index(es):
    • Date
    • Thread