概述
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 position
NSArray* 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];
}
from:http://stackoverflow.com/a/3204078
最后
以上就是醉熏嚓茶为你收集整理的IOS-闪光灯操作的全部内容,希望文章能够帮你解决IOS-闪光灯操作所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复