Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I used a custom slider and set the transform. In the selector I then had a simple if statement to snap it to 100 if greater than 50 and snap to 0 if less. I found the custom slide code online here: <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/11470-there-way-i-can-use-slide-unlock-slider.html" rel="nofollow noreferrer">http://www.iphonedevsdk.com/forum/iphone-sdk-development/11470-there-way-i-can-use-slide-unlock-slider.html</a></p> <pre><code>- (void)create_Custom_UISlider { CGRect frame = CGRectMake(100.0, 110.0, 180, 1.0 ); CGRect thumb = CGRectMake(100.0, 110.0, 1.0, 1.0); customSlider = [[UISlider alloc] initWithFrame:frame]; [customSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged]; // in case the parent view draws with a custom color or gradient, use a transparent color customSlider.backgroundColor = [UIColor clearColor]; customSlider.opaque = 20.0; UIImage *stetchLeftTrack = [[UIImage imageNamed:@"image3.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; UIImage *stetchRightTrack = [[UIImage imageNamed:@"image2.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; [customSlider setThumbImage: [UIImageimageNamed:@"image1.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 = 100.0; customSlider.continuous = NO; customSlider.value = 50.0; customSlider.transform = CGAffineTransformRotate(customSlider.transform,270.0/180*M_PI); } -(void)sliderAction:(id)sender { UISlider *slider = (UISlider *)sender; int progressAsInt = (int)(slider.value + 0.5f); customSliderValue = [NSNumber numberWithInt:0]; customSliderValue = progressAsInt; if (customSliderValue &gt; 50) { [self myMethod1]; [customSlider setValue:100]; } else { [self myMethod2]; [customSlider setValue:0]; } } </code></pre>
 

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