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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:26:58+00:00 2026-05-27T19:26:58+00:00

I tend to do everything with Interface Builder and IBOutlet, so that when I

  • 0

I tend to do everything with Interface Builder and IBOutlet, so that when I want to modify user interface I use to declare a variable in UIViewController, for example:

@property(nonatomic,retain) IBOutlet MyView *myView;

connect it trough Interface Builder and recall in my code using the outlet, then I can access all the other outlet in myView:

UILabel *label = myView.theLabel;

Considering that MyView is very often my main view, I could also do:

UILabel *label = (MyView*)self.view.theLabel;

the syntax is quite long, but this allow me to declare less variable in the .h file and (in my opinion) keep code cleaner, for example with a macro this could become:

#define MV (MyView*)self.view

UILabel *label = MV.theLabel;

which I found to be much more nice to read and maintain.
The point is that I would always do a casting, using iOS 5 what’s the cost in terms of performance ? Considering the UIKit is already a layer on top of something else is UIView object casting somewhat different or more expensive ?
Does the compiler do some kind of optimizations especially with the new arc compiler ?

thanks

  • 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-27T19:26:59+00:00Added an answer on May 27, 2026 at 7:26 pm

    Casting happens at compile time, and as such has absolutely no runtime cost.

    Sidebar: This way of using defines still strikes me as a bit iffy, but hey, if it works for you…

    Edit: The issue you are describing is a result of conflating the purposes of the classes in your code: MyView should not need to have any outlets to speak of; keeping track of all of that jazz is the job of the view controller.

    In other words; you probably don’t want self.view.label; but rather self.relevantNameForTheLabel.

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

Sidebar

Related Questions

I tend to use the bisect command in git extensively. Now I want to
I tend to do this, for example a method that accepts an integer: DoSomethingWithThisInt((int)dbObj.nullableInteger);
I always tend to group all stuff that belongs to a dependency property (registration,
I tend to get the feeling that most folks here think SVN is gold-plated
I tend to use a StatusStrip at the bottom of most of my applications
Whenever I create a PHP library (not a framework) I tend to reinvent everything
Whenever I add a new feature (eg. something I downloaded) I tend to want
I currently have a virtual dedicated server through Media Temple that I use to
So I'm building an app to display photos that are taken by the user,
I tend to write my javascript as big blocks of code without many variable

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.