Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 299313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:48:41+00:00 2026-05-12T06:48:41+00:00

In most examples I see the following setup of IBOutlets: (Example A) FooController.h: @interface

  • 0

In most examples I see the following setup of IBOutlets:



(Example A)

FooController.h:

@interface FooController : UIViewController {
    UILabel *fooLabel;
}

@property (nonatomic, retain) IBOutlet UILabel *fooLabel;

@end

FooController.m:

@implementation FooController

@synthesize fooLabel;

@end

But this works also fine (notice: no property and no synthesize):



(Example B)

FooController.h:

@interface FooController : UIViewController {
    IBOutlet UILabel *fooLabel;
}

@end

FooController.m:

@implementation FooController

@end

Are there any downsides of defining IBOutlets as in Example B? Like memory leaks? Seems to work fine and I prefer to not expose the IBOutlets as public properties as they are not used as such, they are only used in the controller implementation. Defining it in three places without a real need does not strike me as very DRY (Don’t Repeat Yourself).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T06:48:42+00:00Added an answer on May 12, 2026 at 6:48 am

    On Mac OS X, IBOutlets are connected like this:

    1. Look for a method called set<OutletName>:. If it exists call it.
    2. If no method exists, look for an instance variable named <OutletName>, set it without retaining.

    On iPhone OS, IBOutlets are connected like this:

    1. call [object setValue:outletValue forKey:@”<OutletName>”]

    The behavior of set value for key is to do something like this:

    1. Look for a method called set<OutletName>:. If it exists call it.
    2. If no method exists, look for an instance variable named <OutletName>, set it and retain it.

    If you use a property, you’ll fall into the “Look for a method called set<OutletName>:…” case on both platforms. If you just use an instance variable, then you’ll have different retain/release behavior on Mac OS X VS iPhone OS. There’s nothing wrong with using an instance variable, you just need to deal with this difference in behavior as you switch between platforms.

    Here’s a link to full documentation on just this topic.
    https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#//apple_ref/doc/uid/10000051i-CH4-SW6

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most examples (if not all) that I see are the sort of a function
Most examples show how to redirect all subdomain traffic to a primary domain, maintaining
Most examples of creating remote branches involve pushing from a local branch Is there
In most examples that you find on the web when explicitly not using using,
It seems like most examples of JPA/Hibernate entity bean classes I've seen do no
I just wondered, why most Delphi examples use FillChar() to initialize records. type TFoo
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Is Android 2.2 supports Carousel view? Because most of the examples I came across
Most of the DAO examples I've seen consist of simple queries only involving one
What are the examples where we really need 3 Tier Architecture ? Can Most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.