I want to implement the same behavior with the native camera of iOS5
:
- press the volume + button to take a photo
What's the ideal way to archive it? Are there any ways to capture the volume key pressed event?
After googling & searching around for hours, I found 1 solution: using NSNotificationCenter
:
...
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(volumeChanged:)
name:@"AVSystemController_SystemVolumeDidChangeNotification"
object:nil];
...
- (void)volumeChanged:(NSNotification *)notification{
[self takePhoto];
}
However, it has 2 issues:
- There is an semi-transparent overlay of "current system volume" show up every time when pressing the volume key, this is not what I wanted.
- For the native camera, when you press the volume key as shutter, the system volume won't change, however, by using the above method, the system volume will change.