你如何实现MPVolumeView? [英] How do you implement an MPVolumeView?
问题描述
我希望用户能够使用滑块更改系统音量,我意识到执行此操作的唯一方法是使用MPVolumeView。
I want the user to be able to change the system volume with a slider, and I realized the only way to do this is with an MPVolumeView.
但是我找不到任何示例代码,我尝试实现的每个方法都不会显示出来。
But I can't find any example code for it, and every method I try to implement won't show up.
那么最简单,最正确的工作方式是什么? MPVolumeView?
So what is the easiest and correct, working way of implementing a MPVolumeView?
推荐答案
将其作为常规滑块放置,然后使用检查器将类设置为 MPVolumeView
。它仍将在IB中显示为常规滑块,但在运行时,它将是 MPVolumeView
的实例,并且将具有必要的样式和行为。
Place it as a regular slider, then use the inspector to set the class to MPVolumeView
. It'll still be shown as a regular slider in IB, but at runtime, it will be an instance of MPVolumeView
and will have the necessary styles and behavior.
这篇关于你如何实现MPVolumeView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!