How to customize MPVolumeView?

前端 未结 5 1613
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 23:48

I have tried many methods to implement a regular UISlider and control the device volume, but it\'s all Native-C functions which results in many untraceable bugs.

5条回答
  •  悲&欢浪女
    2021-01-31 00:25

    There are now ways to accomplish this, simply use:

    – setMaximumVolumeSliderImage:forState:
    – setMinimumVolumeSliderImage:forState:
    – setVolumeThumbImage:forState:
    

    Which are slightly different method names than the ones for the vanilla UISlider.

    This prevents you from having to cycle through the views and potentially have something break in the future as Apple changes things.

提交回复
热议问题