简体   繁体   中英

MPVolumeView not showing in iOS Simulator

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?

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.

它不起作用,因为它必须反映通过模拟器无法控制的系统值(即实际设备上没有音量硬件按钮)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM