UISlider does not redraw automatically

前端 未结 2 593
暗喜
暗喜 2021-01-28 16:49

I\'ve an UISlider on my app and I need sometimes to update not only its value but also its minimumValue. The values are changed but if I call the setValue method or assign a new

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 17:09

    As UISlider inherits from UIView can you not just call [yourSlider setNeedsDisplay]; after you've updated the values.

    This will force the UISlider instance to completely redraw itself and may therefore take into account the new values you've set.

    EDIT:

    There seems to be some common issues when embedding a UISlider in a UIBarButtonItem - please see this Stack Overflow question for more information.

提交回复
热议问题