Reputation: 711
i want that slider which helps to unlock the iPhone in my app, but i m getting that standard slider.Please tell me is there any way to change that standard slider or there is any code or UI to get that slider which help us to unlock the iPhone...
then how would i get that slider,client is demanding....can we put an image on standard slider of "slide to unlock" slider...what
Upvotes: 2
Views: 1829
Reputation: 2150
The short answer is you have to make your own.
The long answer is that it is possible to customize a UISlider to make it look exactly like the lock slider (this will be cause for rejection, so if you are submitting make it look moderately different even then Apple can be picky about it and may still reject).
setup a UISlider with 2 background images, one for when the slider is in the minimum position, and one for when the slider is in the maximum position, and the image for the thumb.
Here is a sample setup
UIImage *minImage = [UIImage imageNamed:@"sliderback_min.png"];
UIImage *maxImage = [UIImage imageNamed:@"sliderback_max.png"];
UIImage *tumbImage= [UIImage imageNamed:@"slider_thumb.png"];
minImage=[minImage stretchableImageWithLeftCapWidth:25.0 topCapHeight:0.0];
maxImage=[maxImage stretchableImageWithLeftCapWidth:25.0 topCapHeight:0.0];
[lockScreenSlider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[lockScreenSlider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[lockScreenSlider setThumbImage:tumbImage forState:UIControlStateNormal];
lockScreenSlider.minimumValue = 0.0;
lockScreenSlider.maximumValue = 100.0;
lockScreenSlider.continuous = YES;
lockScreenSlider.value = 10.0;
Next use the sliderTouchEnd delegate method to animate the slider falling back to minimum animation when the touch has ended but not fully unlocked. Something like this:
- (IBAction) sliderTouchEnd:(id)sender {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.3];
lockScreenSlider.value = 10.0;
[UIView commitAnimations];
}
You have to make it yourself, but that will get you a very close proximity of the lock screen slider.
Upvotes: 7
Reputation: 2196
Check out this tut:
http://duivesteyn.net/2010/04/15/iphoneos-sdk-custom-uislider-graphics/
Upvotes: 0
Reputation: 19870
You have to make your own one using NSView and finger tracking. There is no Apple provided class for that in the SDK.
Also this might be of help:
Upvotes: 1
Reputation: 8412
If you mean the "slide to unlock" slider, no, there is no way to change it.
Upvotes: 0