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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:52:24+00:00 2026-05-27T20:52:24+00:00

Let’s say I have a view controller, or a window controller, which is (as

  • 0

Let’s say I have a view controller, or a window controller, which is (as usual) the “File’s Owner” in a corresponding XIB file.

It is (as you all know) very common to have IBOutlets in the controller class that you can then connect in the XIB using Interface Builder.

Until now, I have been creating IBOutlet instance variables in my interface (.h) files. But (as you all know) IBOutlets are very often a private mechanism of the controller class; outsiders shouldn’t even know about them.

This is why I now—since Objective-C recently started offering the capability to do so—want to put all of my IBOutlets into my implementation (.m) files.

I tried doing this, and this seems to work fine. My questions are these: Why does this work? I was under the impression that Interface Builder could only view the class’ header files—not peek into their implementation files. Am I wrong? How come that Interface Builder can “see into” implementation files? Could it be potentially dangerous to put IBOutlet instance variables into the implementation files?

  • 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-27T20:52:25+00:00Added an answer on May 27, 2026 at 8:52 pm

    From Xcode 4 User Guide

    Note: Because Xcode 4 parses both your header files and implementation
    files for indexing, you can define actions and outlets in
    implementation (.m) files without needing to place them in the header
    file and you can make connections directly from the nib file to the
    implementation file. Therefore, you do not need to expose parts of
    your interface or actions to clients who might be using your classes.

    And for Could it be potentially dangerous to put IBOutlet instance variables into the implementation files?

    Yes it is, but not that much as any declared method can be accessed because of the lack of access-scope at runtime. Even if the method isn’t accessible, the resolution is done at runtime and no access-scope information is attached to the method.
    That could have been implemented, but Objective-C lacks of private, protected and so on as in C++ or Java.
    Note that implementing such a behavior would be even much slower at runtime.

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

Sidebar

Related Questions

Let's say I have on my controller: @parts = Part.all and on the view
Let's say I have 5 revisions of a README file. How do I view
Let's say you have a tab view controller on the navigation controller view stack.
Let's say I have a PHP Model-View-Controller framework that maps an address like http://example.com/admin/posts/edit/5
Let's say I have a controller function with these lines: $this->load->view('stdHeader_view'); echo <div class='main'>;
Let's say I have a ColorsController and a Colors/Index.cshtml View for that controller. I
Let's say we have a view controller with one sub view. the subview takes
Let's say I have a simple view controller with one UITableView property: @interface MyViewController
So let's say I have a view that access a date: <%= Html.TextBoxFor(model =>
Let's say I have a split view, and I want to fill half of

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.