swift UISlider


    func testUISlider()
    {
        let slider = UISlider(frame: CGRectMake(0, 70, 300,40))
        slider.center = self.view.center
        slider.minimumValue = 0
        slider.maximumValue = 1
        slider.value = 0.5
        slider.continuous=false  //滑块滑动停止后才触发ValueChanged事件
        slider.addTarget(self, action: "valuechage:", forControlEvents: UIControlEvents.ValueChanged)
        self.view.addSubview(slider)
    }
    
    func valuechage(sender: UISlider)
    {
       print(sender.value)
    }


你可能感兴趣的:(swift UISlider)