Increment UISlider by 1 in range 1 to 100

前端 未结 7 1150
既然无缘
既然无缘 2020-12-03 18:19

I am new to iPhone,

How do I have my UISlider go from 1 to 100 in increments of 1?

    slider = [[UISlider alloc] init];
    [slider add         


        
相关标签:
7条回答
  • 2020-12-03 18:57

    I know i'm late to the party but I've also had to do this recently. Here is how I've done it in swift using XCode 8.3.2:

        @IBAction func sliderValueChanged(_ slider: UISlider) {
        label.text = Int(slider.value)
    }
    

    Simples! I know I could have used 'Any' instead of 'UISlider', but I think this makes my intention clearer ;)

    0 讨论(0)
提交回复
热议问题