enum {
AVCaptureDevicePositionB
AVCaptureDevicePositionF
};
typedef NSInteger AVCaptureDevicePosition;
闪光灯开关
enum {
AVCaptureFlashModeOff
AVCaptureFlashModeOn
AVCaptureFlashModeAuto = 2
};
typedef NSInteger AVCaptureFlashMode;
手电筒开关
enum {
AVCaptureTorchModeOff
AVCaptureTorchModeOn
AVCaptureTorchModeAuto = 2,
};
typedef NSInteger AVCaptureTorchMode;
焦距调整
enum {
AVCaptureFocusModeLocked
AVCaptureFocusModeAutoFo
AVCaptureFocusModeContin
};
typedef NSInteger AVCaptureFocusMode;
曝光量调节
enum {
AVCaptureExposureModeLoc
AVCaptureExposureModeAut
AVCaptureExposureModeCon
};
typedef NSInteger AVCaptureExposureMode;
白平衡
enum {
AVCaptureWhiteBalanceMod
AVCaptureWhiteBalanceMod
};
typedef NSInteger AVCaptureWhiteBalanceMod
开启闪光灯
AVCaptureDevice* d = nil; // find a device by positionNSArray* allDevices = [AVCaptureDevice devices]; for (AVCaptureDevice* currentDevice in allDevices) { if (currentDevice.position == AVCaptureDevicePositionB ack) { d = currentDevice; } }
// at this point, d may still be nil, assuming we found something we like.... NSError* err = nil; BOOL lockAcquired = [d lockForConfiguration:&err]; if (!lockAcquired) { // log err and handle... } else { // flip on the flash mode if ([d hasFlash] && [d isFlashModeSupported:AVCaptureFlashModeOn] ) { [d setFlashMode:AVCaptureFlashModeOn]; } [d unlockForConfiguration]; }