Reputation: 247
I'm wanting to control the master volume of the iPhone with a UISlider. There is a way of doing it without code and I've forgot how to. So code or within the xib, how do I do this?
Thanks
Upvotes: 3
Views: 1074
Reputation: 4527
Assuming you already have an instance of the MPVolumeView class, you need to search its subviews to find the MPVolumeSlider view:
UISlider *volumeViewSlider;
// Find the MPVolumeSlider
for (UIView *view in [volumeView subviews])
{
if ([[[view class] description] isEqualToString:@"MPVolumeSlider"])
{
volumeViewSlider = view;
}
}
[volumeViewSlider setValue: 1.0f animated:YES];
[volumeViewSlider _commitVolumeChange];
Hope this helps you out.
Upvotes: 0
Reputation: 966
You can try the following method: Place it in your XIB.
Upvotes: 2