Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + (void)preventSystemVolumePopup {
- // Prevent Audio-Change Popus
- MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(-2000., -2000., 0.f, 0.f)];
- NSArray *windows = [UIApplication sharedApplication].windows;
- volumeView.alpha = 0.1f;
- volumeView.userInteractionEnabled = NO;
- if (windows.count > 0) {
- [[windows objectAtIndex:0] addSubview:volumeView];
- }
- }
- MPVolumeView *volView = [[MPVolumewView alloc] init];
- [self.view addSubview:volView];
- volView.hidden = YES;
- - (void)viewDidLoad {
- // Add an MPVolumeView to my view
- self.volView = [[MPVolumewView alloc] init];
- [self.view addSubview:self.volView];
- self.volView.hidden = YES;
- }
- - (void)someButtonTouched {
- // Show the MPVolumeView (and hopefully hide the system overlay)
- self.volView.hidden = NO;
- }
- - (void)refreshVolumeView {
- [self.volView willMoveToSuperview:self];
- [self.volView didMoveToSuperview];
- }
- - (void)viewDidLoad {
- // Add an MPVolumeView to my view
- self.volView = [[MPVolumewView alloc] init];
- [self.view addSubview:self.volView];
- self.volView.hidden = YES;
- }
- - (void)someButtonTouched {
- // Show the MPVolumeView (and hopefully hide the system overlay)
- self.volView.hidden = NO;
- [self refreshVolumeView]; // <<< This line was added
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement