• 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: CustomView and nib file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CustomView and nib file


  • Subject: Re: CustomView and nib file
  • From: Amul Goswamy <email@hidden>
  • Date: Mon, 29 Sep 2003 10:11:24 -0700

When calling NSBundle loadNibNamed, the object you passed in as owner: becomes the File's Owner as represented in the "myCustomView" nib's Instances tab. You said you had an outlet from the File's Owner to the Custom View so you need to make sure the object sent as the owner ("self" in this case) has an outlet of the same name. You may also need to change the class of your File's Owner, you said it was NSView, you should make it the same class as the object you are sending in as the owner.

That outlet is now a pointer to your custom view, you can now pass that pointer when you call setContentView: on your NSWindow.

Amul Goswamy
Interface Builder QA
Apple


On Sep 28, 2003, at 9:15 AM, Jacques wrote:

Hi folks,

After reading the mailing lists archives, I don't interstood how to use
nib file to put custom view in a window.

I have an NSView on my main window (in MainNib file). In an other nib
file, I have a NSView (with controls) and I would like to replace the
empty NSView (in the main window) by the loaded one.

In the main controller I have an outlet (NSView *theEmptyView).

In the second nib file, file's owner is NSView, and I have an outlet to
connect my NSView.

I can read the nib file :

if(![NSBundle loadNibNamed:@"myCustomView" owner:self])
{
NSLog(@"Failed to load nib file");
NSBeep();
}

But, I don't interstand what to do next to display the custonView in
insteed of theEmptyView.

Thanks in advance for your help,

Jacques

--
PRETRE : personne que tout le monde appelle " Phre " , sauf ses enfants qui
l'appellent " mon oncle " .
P. Desproges
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: CustomView and nib file
      • From: Jacques <email@hidden>
References: 
 >CustomView and nib file (From: Jacques <email@hidden>)

  • Prev by Date: Re: Assembling the Text System
  • Next by Date: Re: NSUserDefaults, setPersistentDomain & NSUserDefaultsDidChangeNotification
  • Previous by thread: CustomView and nib file
  • Next by thread: Re: CustomView and nib file
  • Index(es):
    • Date
    • Thread