swift UISlider

前端之家收集整理的这篇文章主要介绍了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)
    }
原文链接:https://www.f2er.com/swift/323844.html

猜你在找的Swift相关文章