English 中文(简体)
iPhone-无法使用硬按钮调整音量
原标题:iPhone - Can t adjust sound volume with hard buttons

When my app is launched (no sound emitted, Ambiant category set for AudioSession), using the up and down volume button on the iPhone does not do anything : - on screen, nothing is displayed (I mean, the iOS black and white "slider" overlay does not appear to show me that volume is changing). - in app, after playing with hard buttons, no impact on the sound volume when some sound is played (I use an AVAudioPlayer) - this is the same if I quit the app, adjust the sound volume (onscreen "slider"overlay shows up to show me that the sound level have decreased for example), kill the app and relaunch it : same sound level that before

使用这些硬按钮可以在跳板上和其他应用程序中工作(显示“滑块”覆盖,音量也在变化)。

我的应用程序有什么问题?

据我所见,许多应用程序,例如愤怒的小鸟,都会发出声音,在玩游戏时没有硬滑块来改变音量,只需使用硬按钮就可以调整声音。

问题回答

我的应用程序的一些用户也遇到了同样的问题,这不是我的代码,而是他们的iPhone设置:

转到“设置”->;声音->;使用按钮更改并将其设置为关闭

你的应用程序如何处理这些东西取决于你如何设置音频会话。我记得有五种不同的类别可供选择。你选择的类别会影响你的应用程序在硬件按钮、音量、背景等方面的表现。

最好的选择是在这里查看苹果文档:

http://developer.apple.com/library/ios/#DOCUMENTATION/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html#//apple_ref/doc/uid/TP40007875-CH3-SW1

此外,苹果公司有一个非常棒的教程视频,非常好地涵盖了这些内容。链接如下:

https://developer.apple.com/videos/iphone/#video-高级audiodev





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签