[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(systemVolumeChanged:) name:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil];
- (void)systemVolumeChanged:(NSNotification *)not {
float new = [not.userInfo[@"AVSystemController_AudioVolumeNotificationParameter"] floatValue];
self.volume.value = new;
}
本文介绍了一种使用NSNotificationCenter来监听iOS系统音量变化的方法,并展示了如何通过Objective-C代码捕获音量改变的通知并更新应用程序内的音量值。
1716

被折叠的 条评论
为什么被折叠?



