Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this - </p> <pre><code>![- (void)create_Custom_UISlider { CGRect frame = CGRectMake(10.0, 50.0, 300, 52.0); CGRect thumb = CGRectMake(0.0, 0.0, 71.0, 47.0); customSlider = [[UISlider alloc] initWithFrame:frame]; [customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventTouchUpInside]; // in case the parent view draws with a custom color or gradient, use a transparent color customSlider.backgroundColor = [UIColor clearColor]; UIImage *stetchLeftTrack = [[UIImage imageNamed:@"customTrack.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0]; UIImage *stetchRightTrack = [[UIImage imageNamed:@"customTrack.png"] stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0]; [customSlider setThumbImage: [UIImage imageNamed:@"customThumb_off.png"] forState:UIControlStateNormal]; [customSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal]; [customSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal]; [customSlider thumbRectForBounds: thumb trackRect: frame value: customSlider.value]; customSlider.minimumValue = 0.0; customSlider.maximumValue = 1.0; customSlider.continuous = YES; customSlider.value = 0.0; } - (void) sliderAction: (UISlider *) sender { if (customSlider.value != 1.0) //if the value is not the max, slide this bad boy back to zero { [sender setValue: 0 animated: YES]; } else { if (customSlider.value == 1.0) //if the value is max, slide this bad boy back to zero and execute code { [sender setValue: 0 animated: NO]; } // the rest of your code here. } }][1] </code></pre> <p><img src="https://i.stack.imgur.com/kxst1.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/vTIz3.png" alt="enter image description here"></p> <p>Also have a look on this Question - <a href="https://stackoverflow.com/questions/438046/iphone-slide-to-unlock-animation">iPhone &quot;slide to unlock&quot; animation</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload