uislider
Hide UISlider thumb image
Much simpler: Objc [sli setThumbImage:[[[UIImage alloc] init] autorelease] forState:UIControlStateNormal]; Swift version sli.setThumbImage(UIImage(), for: .normal)
How to make a vertical UISlider?
You have to do this programaticaly. Assuming your UISlider is bound to a variable called slider, add this code in your viewDidLoad method in ViewController.m: – (void)viewDidLoad { [super viewDidLoad]; CGAffineTransform trans = CGAffineTransformMakeRotation(M_PI * 0.5); slider.transform = trans; } Let me know if you need any more help on this..
UISlider to control AVAudioPlayer
Shouldn’t be a problem – just set the slider to continuous and set the max value to your player’s duration after loading your sound file. Edit I just did this and it works for me… – (IBAction)slide { player.currentTime = slider.value; } – (void)updateTime:(NSTimer *)timer { slider.value = player.currentTime; } – (IBAction)play:(id)sender { NSURL *url … Read more
How to make UISlider default thumb to be smaller like the ones in the iOS control center
You can’t change the size of the default thumb image, but UISlider has a method setThumbImage(_:for:) that will allow you to pass a similar, smaller image. In your view controller viewDidLoad : let image:UIImage? = // … yourSlider.setThumbImage(image, for: .normal) yourSlider.setThumbImage(image, for: .highlighted) // Also change the image when dragging the slider See Customizing the … Read more
How to get the center of the thumb image of UISlider
This will return the correct X position of center of thumb image of UISlider in view coordinates: – (float)xPositionFromSliderValue:(UISlider *)aSlider { float sliderRange = aSlider.frame.size.width – aSlider.currentThumbImage.size.width; float sliderOrigin = aSlider.frame.origin.x + (aSlider.currentThumbImage.size.width / 2.0); float sliderValueToPixels = (((aSlider.value – aSlider.minimumValue)/(aSlider.maximumValue – aSlider.minimumValue)) * sliderRange) + sliderOrigin; return sliderValueToPixels; } Put it in your view … Read more
UISlider with ProgressView combined
Here’s a simple version of what you’re describing. It is “simple” in the sense that I didn’t bother trying to add the shading and other subtleties. But it’s easy to construct and you can tweak it to draw in a more subtle way if you like. For example, you could make your own image and … Read more