// @name create UiSlider let slider = UiSlider(frame: CGRectMake(30,200 + 130,60,30)) slider.addTarget(self,action: "clickSlider:",forControlEvents: .ValueChanged) slider.minimumValue = 17.0 slider.maximumValue = 36.0 self.view.addSubview(slider) func clickSlider(sender: UiSlider!) { print("UiSlider Value \(sender.value)"); }
打印结果:
UiSlider Vaule: 0.075
原文链接:https://www.f2er.com/swift/324593.html