得到iPhone当前系统的音量 [英] get current system volume level on iPhone

查看:173
本文介绍了得到iPhone当前系统的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法我可以在iPhone上?

当前系统的音量级别

我想也许有一种方法,使从一个 MPVolumeView 和获得的价值。


解决方案

  musicPlayer = [[MPMusicPlayerController iPodMusicPlayer]currentVolume = musicPlayer.volume;

这是现在pcated为iOS8.0,所以请尝试以下去$ P $

 #进口< AVFoundation / AVAudioSession.h>AVAudioSession * audioSession = [AVAudioSession sharedInstance];
CGFloat的体积= audioSession.outputVolume;

Is there a way I can get the current system volume level on the iPhone?

I'm thinking maybe there's a way to make an MPVolumeView and get the value from that.

解决方案

musicPlayer = [[MPMusicPlayerController iPodMusicPlayer];

currentVolume = musicPlayer.volume;

This is now deprecated as of iOS8.0 so try the following

#import <AVFoundation/AVAudioSession.h>

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
CGFloat volume = audioSession.outputVolume;

这篇关于得到iPhone当前系统的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆