Tutorial by Examples

Objective-C Declare a slider property in the ViewController.h or in the interface of ViewController.m @property (strong, nonatomic)UISlider *slider; //Define frame of slider and add to view CGRect frame = CGRectMake(0.0, 100.0, 320.0, 10.0); UISlider *slider = [[UISlider alloc] initWithFrame:...
let frame = CGRect(x: 0, y: 100, width: 320, height: 10) let slider = UISlider(frame: frame) slider.addTarget(self, action: #selector(sliderAction), for: .valueChanged) slider.backgroundColor = .clear slider.minimumValue = 0.0 slider.maximumValue = 50.0 //sending a NO/False would updat...
To add a custom image for the thumb of the slider, simply call the setThumbImage method with your custom image: Swift 3.1: let slider = UISlider() let thumbImage = UIImage slider.setThumbImage(thumbImage, for: .normal)

Page 1 of 1