Created
September 29, 2016 09:38
-
-
Save aniltv06/7328dd74a3d5f499f167ad8f38d8efba to your computer and use it in GitHub Desktop.
Programatically adding UISlider - swift 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
let slider = UISlider(frame:CGRectMake(70, 550, 280, 20)) | |
slider.minimumValue = 0 | |
slider.maximumValue = 100 | |
slider.continuous = true | |
slider.tintColor = UIColor.redColor() | |
slider.value = 50 | |
slider.addTarget(self, action: #selector(ViewController.sliderValueDidChange(_:)), forControlEvents: .ValueChanged) | |
self.view.addSubview(slider) | |
} | |
func sliderValueDidChange(sender:UISlider!) | |
{ | |
print("Slider Value--\(sender.value)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment