To answer you question exactly:
Yes there is other way to change system volume without user interaction.
Until recent times I used to think that changing volume using MPVolumeView programmatically is possible only using private API. But I have just verified, that changing the value of volumeSlider and faking slider's touchUP event works:
MPVolumeView* volumeView = [[MPVolumeView alloc] init];
//find the volumeSlider
UISlider* volumeViewSlider = nil;
for (UIView *view in [volumeView subviews]){
if ([view.class.description isEqualToString:@"MPVolumeSlider"]){
volumeViewSlider = (UISlider*)view;
break;
}
}
[volumeViewSlider setValue:1.0f animated:YES];
[volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside];
(When slider receives touchUP event, it will invoke _commitVolumeChange
method on itself, which will change the system volume)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…