Slider with real time in Label

前端 未结 4 1117
Happy的楠姐
Happy的楠姐 2021-01-28 22:04

I need a slider for displaying real time in slider-label from 12-00 AM to 11-45 PM with step size 15 minutes. But I just have no idea how to do it. Сan anybody give some suggest

4条回答
  •  醉梦人生
    2021-01-28 22:51

    I'm adding another answer to add code. Yes, you can get the value from the slider and then set the text of the label after converting the value to a time. Like so:

    // Add 0.5 to slider value and truncate it to an integer by type casting it as integer
    int sliderIntValue = (int)([sender value] + 0.5f);
    
    //do some conversion and set the label to the value
    
    self.sliderLabel.text = newLabelText;
    

提交回复
热议问题