标签:
- (void)setPhoneVolume { MPVolumeView *volumeView = [[MPVolumeView alloc] init]; UISlider* volumeViewSlider = nil; for (UIView *view in [volumeView subviews]){ if ([view.class.description isEqualToString:@"MPVolumeSlider"]){ volumeViewSlider = (UISlider*)view; break; } } // retrieve system volume float systemVolume = volumeViewSlider.value; // change system volume, the value is between 0.0f and 1.0f [volumeViewSlider setValue:1.0f animated:NO]; // send UI control event to make the change effect right now. [volumeViewSlider sendActionsForControlEvents:UIControlEventTouchUpInside]; }
标签:
原文地址:http://my.oschina.net/SoulJa/blog/485933