ios7 - iOS 7: MPMusicPlayerController volume deprecated. How to change device volume now? -
mpmusicplayercontroller setvolume deprecated since ios 7
is there other way change system music volume? preferably without user interaction. important feature: increase volume automatically alarm clock appstore.
to answer question exactly: yes there other way change system volume without user interaction.
until recent times used think changing volume using mpvolumeview programmatically possible using private api. have verified, changing value of volumeslider , faking slider's touchup event works:
mpvolumeview* volumeview = [[mpvolumeview alloc] init]; //find volumeslider uislider* volumeviewslider = nil; (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, invoke _commitvolumechange
method on itself, change system volume)
Comments
Post a Comment