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 7802541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:17:47+00:00 2026-06-02T01:17:47+00:00

When using IB in combination with assistant view you control-drag an element in the

  • 0

When using IB in combination with assistant view you control-drag an element in the IB to the .h file and create an outlet. You can drag it to one of 2 place, either inside the variable declaration block or outside the block.

If you drag it inside the variable block you get something like this:

@interface MyViewController : UIViewController {
    IBOutlet UIButton *foo;
}

dragging it outside the block gives you something like….

@interface ViewController : UIViewController {
}
@property (retain, nonatomic) IBOutlet UIButton *foo;

I’ve thought about how they are different and I’m a little confused. Ok, I understand synthesized properties do some magic and create instance variables at runtime (only on 64bit/ARM). So I believe I understand how the 2 options work.

What’s the best option though? First option generates less code and seems simpler.

Second version offers public accessors/mutators, but I rarely access outlets from outside my class (and if I do, it’s almost always with encapsulation). From the time I’ve started iOS work I’ve exclusively used this option.

Am I missing anything or should I make the switch to variable based outlets in most cases?

  • 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-06-02T01:17:48+00:00Added an answer on June 2, 2026 at 1:17 am

    Short answer: It doesn’t make a much of a difference either way.

    Long answer: If you want set/mutator methods, then drag outside of the block. If you don’t care about methods and are just going to access the variables directly then putting them in as straight variables inside the block is probably the way to go.

    Public visibility:
    If you just specify the IBOutlet as a variable then you can use @private or @protected to prevent outside access. If you really want a @property for some reason you can still control public visibility by moving the property out of the .h and into a class extension in the .m file.

    Conclusion: Myself, I’m sticking with the straight variable declaration and save the other options for when I need something extra.

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

Sidebar

Related Questions

I am using the combination of shm_open() and mmap() to create a shared memory
I am trying to create a simple mouseover effect using a combination of mouseover,
I'm using the combination of json_encode (PHP) and JSON.parser (Javascript from json.org) for passing
I'm using a combination of PHP and Phonegap. I use PHP to build the
I am trying to make a search function using the combination of DOM, PHP
Classification and regression trees by Breiman et al mentioned about using linear combination of
All these years i have been successfully using EnumServicesStatus in combination with OpenScManager (with
I am using jQuery cycle in combination with a mousewheel plugin. I have built
How do I pass a certain key combination to a spawned/child process using the
I'm using .class1.class2 .class3 selector, where .class1.class is a combination selector and .class3 belongs

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.