iPhone如何以编程方式覆盖默认设置

时间:2013-05-23 11:09:38

标签: iphone ios audio iphone-vibrate

在iPhone中,如何以编程方式覆盖振动和声音的默认设置?

2 个答案:

答案 0 :(得分:0)

除非你为越狱设备做这件事,否则你不能这样做。 Apple不接受以编程方式更改手机设置。这最终是用户偏好。

答案 1 :(得分:0)

我认为你不能(如果你的应用程序是在越狱设备上运行的话,那可能是可能的)。因为没有Apple API可以访问iPhone设置。但您可以更改应用程序Bundle中的设置。对于振动,您可以使用

 #import <AudioToolbox/AudioServices.h>

并使用

 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); 

您可以使用

进行音量调节
AVSystemController

[[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:@"Ringtone"];

Try this SO Question 然而,Best将使用MPVolumeView(音量滑块)来改变设备音量,但只能通过用户交互。

MPVolumeView是工具箱中的一个控件,您需要在项目中添加MediaPlayer.framework,然后MPVolumeView将显示在界面构建器的工具箱中。

相关问题