Limit sliding UISlider past certain point

前端 未结 3 1783
终归单人心
终归单人心 2021-01-19 03:06

Let\'s assume a have a UISlider to which I set a certain value. The slider handle then moves to that value, as expected.

Now I want to let the user sli

3条回答
  •  情歌与酒
    2021-01-19 03:38

    Connect your slider to valueChanged: action. You should implement it something like:

    - (void)mySliderValueChanged:(UISlider *)slider
    {
      CGFloat myMinValue = 50.0f; // should be a global variable
    
      if(slider.value < myMinValue)
      {
        slider.value = myMinValue;
      }
    }
    

提交回复
热议问题