As title, i’m trying to pass value of slider to containerView but it’s not work
here’s my code:
class ViewController: UIViewController {
@IBOutlet weak var ValueLabel: UILabel!
@IBOutlet weak var sliderControll: UISlider!
override func viewDidLoad() {
super.viewDidLoad()
sliderControll.maximumValue = 5
sliderControll.minimumValue = 0
sliderControll.value = 0
sliderControll.isContinuous = false
self.sliderControll.addTarget(self, action: #selector(ViewController.printData), for: UIControlEvents.valueChanged)
}
func printData(){
ValueLabel?.text = String(self.sliderControll.value)
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "dataID" {
let destination = segue.destination as! SubViewController
destination.myString = (ValueLabel?.text)! as String
}
}
}
thanks!