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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:16:55+00:00 2026-05-28T05:16:55+00:00

I have a UISlider and I’m basically splitting it into 5 segments. 0 <=

  • 0

I have a UISlider and I’m basically splitting it into 5 segments.

0 <= x < .2
.2 <= x < .4
.4 <= x < .6
.6 <= x < .8
.8 <= x <= 1

I’m trying to synchronize this with another scrollView that zooms that I have so when I move the slider, the scrollView zooms, AND when I pinch on the scrollView, the slider moves.

When I initialize my slider in the viewDidLoad, I created different thumbImages for the UIControlStateNormal and UIControlStateSelected like this:

if ([self.navigatorSlider value] >= 0 && [self.navigatorSlider value] < .2) {
    [self.navigatorSlider setThumbImage:[UIImage imageNamed:@"firstZoom.png"] forState:UIControlStateNormal];
    [self.navigatorSlider setThumbImage:[UIImage imageNamed:@"firstZoom.png"] forState:UIControlStateSelected];
}

I do this for each of the 5 diffrent sections I noted above. However in the IBAction method I have for the slider, I need to set the thumbImages again doing the same checks. Also in my handleZoom method I need to setThumbImage in that method too. Am I doing something wrong? I feel like I should be able to set these values somewhere and the images will be changed automatically when the slider changes, no matter if it comes from handling the slider itself, or zooming in on the scrollView and using the setValue method for the slider.

Thoughts?

  • 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-28T05:16:56+00:00Added an answer on May 28, 2026 at 5:16 am

    Looking at the properties that UISlider provides, you can get a pretty strong sense that while the class is designed to let you customize it’s appearance, dynamically changing the appearance of the control as the user adjusts it probably wasn’t what the designer had in mind. Otherwise, they’d have included the sort of mechanism you suggest: a means to associate different images with ranges of values.

    The first thing that comes to mind if you want to simplify your approach is to use KVO to observe a slider. If you could get a notification every time the slider’s value is updated, you could update the thumb image in one place. Unfortunately, it looks like UISlider doesn’t fully support KVO.

    The next thing I’d consider would be creating your own slider control. This isn’t rocket science — all you need is to draw the control, draw the thumb on top, and allow the thumb to slide in one dimension. If you make the thumb a subview of the rest of the control, that’s a piece of cake. Then you can add KVO support if you want, or go all the way and support different thumb images for different ranges.

    If you don’t want to do that, you might be able to subclass UISlider to add your array of images, array of ranges, and an override of -setValue: to make use of them.

    Finally, what you’ve got now isn’t really so bad. If you’ve repeated the code in both your action and -handleZoom methods, that’s not so good, but it should be simple to factor out the common code into an appropriate method that you can call from both places.

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

Sidebar

Related Questions

I have a UISlider as part of a view that is loaded into a
I have a UISlider and I'm trying to pass its value into a window.scrollBy
In a tableviewcell I have a UISlider. If I move the slider knob, go
I am using the jQuery UISlider. I have it set up so that upon
I have a custom UITableViewCell that contains a UISlider control and a UILabel which
I want to rotate a image with UIslider control. I have done that with
I have a UIView subclass that draws a simple rectangle with this code: -
I have a UISlider that I want to update a UITextField for the value
For example, I have a UISlider that calls - (IBAction)sliderMoved:(id)sender , which performs some
I have a UISlider that I wan't to have a custom look for. I

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.