MPVolumeView not showing in iOS Simulator
Asked Answered
U

2

6

This code works fine on a physical iPhone 6, but on iOS simulator the MPVolumeView doesn't show.

- (void)setUpVolumeView
{    
    CGRect sliderRect = CGRectMake(20, 400, 300, 20);
    self.myVolumeView = [[MPVolumeView alloc] initWithFrame:sliderRect];
    [self.view addSubview: self.myVolumeView];
}

self is in this case a ViewController.

Anyone know why this happens?

Underhand answered 21/4, 2015 at 21:7 Comment(0)
R
12

MPVolumeView has, as far back my memory goes, never worked in the simulator. It's always either shown nothing or displayed "No volume available" in white text.

Ribbonfish answered 22/4, 2015 at 0:44 Comment(1)
Changed the background to grey to see which it was. No text, no volume view. Thanks.Underhand
E
4

It doesn't work because it has to reflect the system value which is not controllable through the simulator (i.e no volume hardware buttons as there are on the actual device).

Electuary answered 19/2, 2017 at 20:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.