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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:38:09+00:00 2026-06-09T12:38:09+00:00

Possible Duplicate: Objective-C – When to use 'self' I needed a variable to be

  • 0

Possible Duplicate:
Objective-C – When to use 'self'

I needed a variable to be passed from one view to another so I made a property called StringC in the .h and accessed it using self.StringC (that part worked).

I also need some arrays that are accessible throughout the view but I’m using them differently.

For instance I have lvLabelArray and I’m using

self.lvLabelArray=[[NSMutableArray alloc]init];

and then later I’m using

[lvLabelArray addObject:LabelText];

Is there a difference between that and

[self.lvLabelArray addObject:LabelText];

?

Sorry I don’t know the terms for those kinds of variables.

  • 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-09T12:38:10+00:00Added an answer on June 9, 2026 at 12:38 pm

    There is an important difference there.

    self.attribute goes through the object’s getter or setter function, as appropriate. That allows you to set up initial values, trigger update messages, or anything else.

    Accessing “attribute” directly goes straight to the underlying variable, so you bypass all that. As a result, it’s definitely the less-preferable way of working.

    A common way of avoiding this confusion, and just plain mistakes, is to rename the underlying variable. Instead of just “@synthesize attribute”, use “@synthesize attribute = _attribute”. This will create the getter and setter methods as before, but they’ll the underlying variable is named “_attribute”. That means that trying to use “attribute” without “self” will trigger a compiler error.

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

Sidebar

Related Questions

Possible Duplicate: Objective-C - When to use 'self' I am having problem understanding the
Possible Duplicate: difference between accessing a property via “propertyname” versus “self.propertyname” in objective-c? In
Possible Duplicate: Objective C defining UIColor constants I'd like to use few colours throughout
Possible Duplicate: Global Variables in Cocoa/Objective-C? problem with declare a global variable in objective
Possible Duplicate: Calling Python from Objective-C I'm a long-time Python programmer and short-time Cocoa
Possible Duplicate: How to convert from int to string in objective c: example code…
Possible Duplicate: In Objective-C why should I check if self = [super init] is
Possible Duplicate: Prefixing property names with an underscore in Objective C When synthesizing properties
Possible Duplicate: Prefixing property names with an underscore in Objective C iPhone App Developer
Possible Duplicate: Global int variable objective c I would like to create a global

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.