UISlider with ProgressView combined

后端 未结 9 1381
无人共我
无人共我 2020-11-29 16:07

Is there an apple-house-made way to get a UISlider with a ProgressView. This is used by many streaming applications e.g. native quicktimeplayer or youtube. (Just to be sure:

9条回答
  •  粉色の甜心
    2020-11-29 16:55

    Idea 1: You could easily use the UISlider as a progress view by subclassing it. It responds to methods such as 'setValue:animated:' with which you can set the value (i.e: progress) of the view.

    Your only 'restriction' creating what you see in your example is the buffer bar, which you could create by 'creatively' skinning the UISlider (because you can add custom skins to it), and perhaps set that skin programmatically.

    Idea 2: Another (easier) option is to subclass UIProgressView, and create a UISlider inside that subclass. You can skin the UISlider to have a see-through skin (no bar, just the knob visible) and lay it over the UIProgressView.

    You can use the UIProgressView for the pre-loading (buffering) and the UISlider for movie control / progress indication.

    Seems fairly easy :-)

    Edit: to actually answer your question, there is no in-house way, but it would be easy to accomplish with the tools given.

提交回复
热议问题