Michal
Michal

Reputation: 15669

Touch Up Inside not working with UISlider

I have linked my UISlider with two methods - Touch Up Inside and Value Changed. First one to update once dragging is complete and second one to update during dragging. When I drag "long" distance over the screen with slider, everything is fine. When I drag step-by-step, Value Changed works fine, but Touch Up Inside doesn't...anybody experienced same thing?

Upvotes: 1

Views: 2864

Answers (1)

Michal
Michal

Reputation: 15669

The problem was with gesture recognizer. As I implemented method for recognizing "tap" on the slider in order to make the slider move quickly to that spot without the need to frag it there, I forgot to separate it from the touch up inside with if-else statement.

UISlider* s = (UISlider*)gestureRecognizer.view;
if (s.highlighted) {
    switch (s.tag) {
        case 1:
            [_cpuStepper setValue:[s value]];
            break;
        case 2:
            [_ramStepper setValue:[s value]];
            break;
        case 3:
            [_hddStepper setValue:[s value]];
            break;
        default:
            break;
    }
    [self updatePrice];
    return; // on thumb
}

All working now.

Upvotes: 2

Related Questions