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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:37:57+00:00 2026-06-02T18:37:57+00:00

I’m confused with the usage of properties in Objective-C. If I create a new

  • 0

I’m confused with the usage of properties in Objective-C. If I create a new IBOutlet like this:

IBOutlet UISlider *uploadSlider;

And then define a property for the slider so I can use its getters and setters:

@property (nonatomic, strong) IBOutlet UISlider *uploadSlider;

And then @synthesize it in the implementation file, what is the proper way to actually use the property? For example, if I want to change the slider’s track image, do I call

    [uploadSlider setMaximumTrackImage:[UIImage imageNamed:@"An image"] forState:UIControlStateSelected];

Or:

[self.uploadSlider setMaximumTrackImage:[UIImage imageNamed:@"An image"] forState:UIControlStateSelected];

The method that I prefix with self is only available after defining properties, which makes me think that it is the correct choice. But I don’t understand why. Do I even need properties to access these methods?

Also, if I am using dot syntax to get or set information pertaining to an object, must I define properties for the object even though I am not directly accessing one of its instance methods?

  • 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-02T18:37:59+00:00Added an answer on June 2, 2026 at 6:37 pm

    The current best practice is to put this in your .h file if you want it to be publicly available or in an interface section of your .m file if you want it to be private (which maybe what you want). Also, IBoutlet usually use a weak pointer and should be set to nil in your viewDidUnload method.

    So, in your .h file if public

     @property (nonatomic, strong) IBOutlet UISlider *uploadSlider;
     //IBOutlet's are usually weak
    

    or in your .m file if private

     @interface
     @property (nonatomic, strong) IBOutlet UISlider *uploadSlider;
     //IBOutlet's are usually weak
     @end
    

    Then, in your .m file you put @synthesize like this

     @synthesize uploadSlider = _uploadSlider;
    

    Which will generate the getter and setter and also an instance variable called _uploadSlider, so that you are aware how you are accessing it.

    Then, the correct way to call it is:

    [self.uploadSlider]
    

    which is really the same as

    [self getUploadSlider]
    

    Also, for your information, when you look in the Apple documentation, anything that is a property should be called using the . syntax and anything else should be called using the message.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:

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.