当前位置: 代码迷 >> 综合 >> swift UISlider
  详细解决方案

swift UISlider

热度:82   发布时间:2023-12-15 01:56:03.0


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