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?