在 iOS 7 中更改 flash 状态以供AVCaptureDevice
使用时:
if ([self.avCaptureDevice isFlashModeSupported:self.avCaptureFlashMode])
{
NSError *error = nil;
[self.avCaptureDevice lockForConfiguration:&error];
if (!error) [self.avCaptureDevice setFlashMode:self.avCaptureFlashMode];
[self.avCaptureDevice unlockForConfiguration];
}
AVCaptureSessions
除非停止并启动,否则设备不会使用闪光灯:
[self.avCaptureSession stopRunning];
[self.avCaptureSession startRunning];
这会导致相机短暂闪烁变黑。是否可以在不停止/启动会话的情况下切换闪光灯?