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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:08:27+00:00 2026-06-18T07:08:27+00:00

I have 4 UISliders that need to have values from 1-5 with 1 being

  • 0

I have 4 UISliders that need to have values from 1-5 with 1 being the minimum value and 5 the maximum.

I have set up the sliders and call them slider1, slider2, slide3, slider4

I have also set up the outlets etc and set the minimum and maximum values in interface builder

However when I scroll the slider it just slides instead of sticking to the 1-5 scale.

I have attempted the following and am failing miserably as I saw this at some other SO question

- (IBAction) sliderValueChanged:(id)sender
{

    [sender setValue:((int)((sender getValue] + 2.5) / 5) * 5) animated:NO];

}

UPDATED: This seems to work as a solution

   - (IBAction) sliderValueChanged:(UISlider *)sender
{

    NSUInteger index = (NSUInteger)([sender value] + 0.5); // Round the number.
    [sender setValue:index animated:NO];
    NSLog(@"index: %i", index);

 //   NSNumber *number = [numbers objectAtIndex:index]; // <-- This is the number you want.
 //   NSLog(@"number: %@", number);

}

can you help me with this? I am getting an error with the getValue function also above.

  • 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-18T07:08:28+00:00Added an answer on June 18, 2026 at 7:08 am

    Objective-C ain’t Java, the naming convention for getters is different. Use value instead of getValue (and anyways, why don’t you declare sender as UISlider *?)

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

Sidebar

Related Questions

I have 4 values in UISlider . I want that when the slider value
I have two UISliders that both have value range of 1 to 8. When
I have several jQuery UI Sliders and I want to collect their values. Thought
I have set my UISlider up to respond to value changed events: [customSlider addTarget:self
I have a UILabel in an interactive calculator application that is continually being refreshed
I am using the jQuery UISlider. I have it set up so that upon
I want that i have 4 values in UISlider and i want that bydefaul
I have an imageview that I am scaling and rotating via UISliders. Here is
I have a UISlider that I want to update a UITextField for the value
Assume I have a UISlider representing a continuous range of values from -1 to

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.