• 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: Which thing should be an IBOutlet?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Which thing should be an IBOutlet?


  • Subject: Re: Which thing should be an IBOutlet?
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 12 Dec 2012 17:12:20 -0800

In general these days, put an IBOutlet marker on a @property declaration.

However, ask yourself first: Is the IBOutlet part of the public API exposed by your class?

If the answer is yes, then put that @property declaration in the public @interface to the class in the primary .h file.

If the answer is no, however, then put that @property declaration in a class continuation in the primary .m file for the class instead.

The answer is likely to be "no" most of the time, unless you're creating a reusable class whose instances can connect to an arbitrary other object.

One example where the answer is "yes" is NSViewController, which has a "view" outlet. Another similar example is NSTableView, which has data source and delegate outlets. These are API and belong in the corresponding header.

An example where the answer is "no" is something like a "login panel controller" - the UI for the panel is an implementation detail, and therefore references to that UI don't belong in the "public" header.

  -- Chris

On Dec 11, 2012, at 1:44 PM, Steve Mills <email@hidden> wrote:

> Which should be the IBOutlet for connecting a control in a nib to its owner class? The instance variable:
>
> @interface Blah
> {
>    IBOutlet Thing* thing;
> }
>
> @property (assign) Thing* thing;
> @end
>
> Or the property:
>
> @interface Blah
> {
>    Thing* thing;
> }
>
> @property (assign) IBOutlet Thing* thing;
> @end
>
> Or both:
>
> @interface Blah
> {
>    IBOutlet Thing* thing;
> }
>
> @property (assign) IBOutlet Thing* thing;
> @end
>
> I've seen examples of the first two.
>
> --
> Steve Mills
> office: 952-818-3871
> home: 952-401-6255
> cell: 612-803-6157
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Which thing should be an IBOutlet? (From: Steve Mills <email@hidden>)

  • Prev by Date: possible bug with refactoring and workspaces
  • Next by Date: Re: Indexing Forever
  • Previous by thread: Re: Which thing should be an IBOutlet?
  • Next by thread: Symbols Hidden by Default
  • Index(es):
    • Date
    • Thread