views:

260

answers:

1

Hey!

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.

So what is the easiest and correct, working way of implementing a MPVolumeView?

+1  A: 

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.

warrenm
IB won't change the Class of the slider..
Emil
Fascinating. It appears that it's no longer recognized as a `UISlider` subclass. As a workaround, you can create a generic `UIView` and size it to be 20px tall (for iPhone at least), then set the class to `MPVolumeView`. Be sure to set the background to a transparent color. Note that the class doesn't work in the simulator.
warrenm
Thank you, it works now, I only need help placing it in a UIAlertView now.. http://stackoverflow.com/questions/2829234/mpvolumeview-in-a-uialertview
Emil