-(void)setIphoneVolume{
//iOS 7.0之前
// MPMusicPlayerController* musicController = [MPMusicPlayerController applicationMusicPlayer];
// musicController.volume = 1;
之后
MPVolumeView *volumeView = [[MPVolumeView alloc] init];
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
volumeViewSlider = (UISlider*)view;
break;
}
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[volumeViewSlider setValue:1 animated:YES]; 0最小 1最大
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
});
}