• 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: get ref to instance from IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get ref to instance from IB


  • Subject: Re: get ref to instance from IB
  • From: Andy Lee <email@hidden>
  • Date: Tue, 16 Jun 2009 20:36:34 -0400

On Tuesday, June 16, 2009, at 08:10PM, "Paul M" <email@hidden> wrote:
>Thanks for all the good information here. It's helping a lot.
>My data is largely static, if it does change it all changes, so if I
>save references to all my wrappers, I can just dump the lot and start
>over if there are changes.
>I'll probably create them on an 'as required' basis to prevent a bump
>at startup.
>I think this should all be pretty simple, as you indicated with your
>'cheap lunch' comment.
>
>I'm still not clear on the first point thgough.
>
>> What is "File's Owner"? Whatever object that is, add IBOutlets to it
>> and wire them to the objects of interest in the nib. The outlets are
>> just ordinary ivars to the object that is "File's Owner".
>
>'File's Owner' seems to be an instance of NSApplication. I cant add an
>IBOutlet to this class, and when I subclass it, I find I cant
>instatiate(sp) the subclass. I'm stumbling in the dark a bit here.

You don't want to instantiate the application class.  The application object will have been created for you before the main nib file is loaded.  What you do is, you tell IB to that object should be an instance of your application subclass instead of the default class.  Select the File's Owner in the main nib file, and in the "Identity" tab of the Inspector (it's indicated with an "i" icon), type the name of your subclass.

Unlike most of the other objects in a nib (First Responder being the other exception), "File's Owner" is not an actual object "in" the nib.  It is a *placeholder* for an object that will be specified at runtime -- in this case, the application object.  At runtime, when a nib is loaded, a "file's owner" (some existing object in your program) is specified, and all the connections in the nib that went to "File's Owner" are connected to *that* object.

When you create your own nib files, you will decide what the File's Owner will be.  For the main nib file, it must be the application object.

BTW, you mention NSApplication but also UIController.  Is that a typo?  The default application class is UIApplication on the iPhone -- it's NSApplication on the Mac.

--Andy


><later>
>I just tried adding these outlets to my UIController class (this class
>just needs to be visible where nesesary right?), made the nesesary code
>changes ... and it seems to be working. It's late so I'll thrash on
>this more tomorrow and make sure it's not some silly mistake ... but
>here's hoping.
>
>
>Big thanks to all who chipped in, I hope I dont have to bother you
>again tomorrow.
>
>
>paulm
>
>_______________________________________________
>
>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
>
>
_______________________________________________

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

  • Follow-Ups:
    • Re: get ref to instance from IB
      • From: Paul M <email@hidden>
  • Prev by Date: Re: get ref to instance from IB
  • Next by Date: Detecting Threading Design Errors in Core Data
  • Previous by thread: processing AppleEvents if a modal window is open?
  • Next by thread: Re: get ref to instance from IB
  • Index(es):
    • Date
    • Thread