• 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: Bypassing Interface Builder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bypassing Interface Builder


  • Subject: Re: Bypassing Interface Builder
  • From: Johnny Lundy <email@hidden>
  • Date: Wed, 14 May 2008 22:33:46 -0400

Actually, I have read that many times. My reason for reading it was that so many example codes and tutorials say to bind an interface item to File's Owner, but don't say why or what that binding accomplishes.

So it's the application instance. I don't understand what the application instance is. I can recite the documentation, which says it is a shared instance of NSApplication, also known as NSApp which is a global variable, none of which help me.

Why would someone bind to File's Owner? What specifically is it? My current trial-and-error practice is to make an NSObject in IB and name it one of my classes and then bind to a property through that NSObject instance - this lets me bind to my ivars. There is no controller, however (or at least nothing NAMED "NSxxxController"), so I don't know if I am violating MVC by essentially connecting the view to the model through this NSObject.

What I meant by IB won't let me make 2 instances of a class is - try and type the same class name in a second time - it disappears when you end editing. E.g. if I want 2 NSObjects that both have MyClass as their class, it will take the first one but erase the textfield when I finish editing the second one.


On May 14, 2008, at 9:23 PM, email@hidden wrote:


Message: 6 Date: Wed, 14 May 2008 21:06:06 -0400 From: Andy Lee <email@hidden> Subject: Re: Bypassing Interface Builder To: Cocoa-dev <email@hidden> Message-ID: <email@hidden> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

On May 14, 2008, at 8:51 PM, I. Savant wrote:
Also, the documentation only says about File's Owner that it is the
object that loaded the nib file. What is that object, if my nib
file just gets loaded at application launch?

Your app's NSApplication instance. This is in the documentation.

It can be a little tricky to find, though. I found it in the first hit from Googling "cocoa file's owner":

<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CoreAppArchitecture/chapter_7_section_8.html

"Each Cocoa application has a main nib file that contains the
application-specific menus and possibly one or more windows. NSApp is
File's Owner of the main nib file. When an application launches, NSApp
loads the main nib file, unarchiving it, and displays the menus and
initial windows. Many applications have auxiliary nib files for such
things as documents and panels; these nib files are loaded on demand
(that is, when the user requests behavior provided by objects in the
nib file)."

--Andy

_______________________________________________

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: Bypassing Interface Builder
      • From: Andy Lee <email@hidden>
  • Prev by Date: Re: Guidance for Cocoa's steep learning curve
  • Next by Date: Re: Bypassing Interface Builder
  • Previous by thread: Re: Bypassing Interface Builder
  • Next by thread: Re: Bypassing Interface Builder
  • Index(es):
    • Date
    • Thread