iosdeveloper/SlideToCancel — Issue #1: Incorrect math
Author: H2CO3
Created: 2011-11-02 13:47:45+00:00
State: open

On line 176 in SlideToCancelViewController.m, it reads:

- (void) sliderChanged: (UISlider *) sender
{
// Fade the text as the slider moves to the right. This code makes the
// text totally dissapear when the slider is 35% of the way to the right.
label.alpha = MAX(0.0, 1.0 - (slider.value * 3.5));

// Stop the animation if the slider moved off the zero point
if (slider.value != 0) {
[self stopTimer];
[label.layer setNeedsDisplay];
}
}

Lines 178-180:

// Fade the text as the slider moves to the right. This code makes the
// text totally dissapear when the slider is 35% of the way to the right.
label.alpha = MAX(0.0, 1.0 - (slider.value * 3.5));

It's not true. It makes the text disappear when it reaches 1/3.5 which is approx. 28.6 %. The corrected line 180 would be:

label.alpha = MAX(0.0, 1.0 - (slider.value / 0.35));