applicationMusicPlayer volume notification

后端 未结 6 1227
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 02:28

I am using an applicationMusicPlayer and when i try to change the volume appear the visual notification, as shown in the picture. Here the code I am using:

[         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-11-30 03:20

    I encountered the same issue recently. Instead of adding the MPVolumeView to current view controller's view, I add it to the application's window once at the start of the app:

    CGRect rect = CGRectMake(-500, -500, 0, 0);
    MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:rect];
    [self.window addSubview:volumeView];
    

    This works in both iOS 7 and 8.

提交回复
热议问题