1
votes

I am having a problem with updating the value of a UISlider. I am using the following code to call function whenever I move the UISlider :

[photoSlider addTarget:self action:@selector(updateImage2) forControlEvents:UIControlEventTouchDragInside];

And inside the updateImage2, I have the following lines:

NSUInteger index=photoSlider.value;

if (index>11) {
    photoSlider.value=11;
    index=photoSlider.value;
}

Now, if this code works correctly, the slider value should never go beyond 11. In my case, thats not happening.

Can anyone kindly tell me whats happening ? Thanks.

edit:

Solved with :

[photoSlider addTarget:self action:@selector(updateImage2) forControlEvents:UIControlEventValueChanged];
1

1 Answers

0
votes

Yes, you need use UIControlEventValueChanged event