UISlider with increments of 5

后端 未结 6 1175
离开以前
离开以前 2020-11-29 01:16

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

6条回答
  •  悲哀的现实
    2020-11-29 01:45

    1. In storyboard mode, drag and drop a stepper and label.  the label will show the stepper values. 
    
    1. left click and drag both label and stepper to your view controller as outlets.

    name label as "stepperValue"

    1. drag and drop stepper again making it a func- I called mine "func"

    @IBAction func inc(sender: AnyObject) {
    stepperValue.text = "(Int(stepper.value) * 5 )"

    click the stepper and it will increment by 5

提交回复
热议问题