lz最近發(fā)現(xiàn)二維碼很是好玩,雖然之前寫過zing和zbar的,但是那都是蘋果讓程序必須支持64位之前的事了辜王,所以我就決定研究下蘋果自帶的二維碼掃描以及生成劈狐,之前為了一個(gè)處女座需求查了好多資料,也在微博求助了好多大牛誓禁,但是基本沒有一個(gè)搭理我懈息,所以更加激勵(lì)我肾档,于是乎我就從最根本的開始研究摹恰。這幾天終于有眉目了,這里貼出打開攝像頭相關(guān)的一些設(shè)置怒见,之后會(huì)有更新以及github的我寫的利用系統(tǒng)庫進(jìn)行二維碼的掃描與生成俗慈,避免了添加第三方庫的繁瑣和工程文件過大的煩惱。希望大家共同進(jìn)步遣耍。
AVCaptureDevice.h 主要用來獲取iPhone一些關(guān)于相機(jī)設(shè)備的屬性闺阱。
必須引用一個(gè)系統(tǒng)包:#import
1.前置和后置攝像頭
typedef NS_ENUM(NSInteger, AVCaptureDevicePosition) {
AVCaptureDevicePositionUnspecified = 0,
AVCaptureDevicePositionBack = 1,
AVCaptureDevicePositionFront = 2
} NS_AVAILABLE(10_7, 4_0);
2.閃光燈開關(guān)
typedef NS_ENUM(NSInteger, AVCaptureFlashMode) {
AVCaptureFlashModeOff = 0,
AVCaptureFlashModeOn = 1,
AVCaptureFlashModeAuto = 2
} NS_AVAILABLE(10_7, 4_0);
3.手電筒開關(guān)--其實(shí)就是相機(jī)的閃光燈
typedef NS_ENUM(NSInteger, AVCaptureTorchMode) {
AVCaptureTorchModeOff = 0,
AVCaptureTorchModeOn = 1,
AVCaptureTorchModeAuto = 2,
} NS_AVAILABLE(10_7, 4_0);
4.焦距模式調(diào)整
typedef NS_ENUM(NSInteger, AVCaptureFocusMode) {
AVCaptureFocusModeLocked = 0,
AVCaptureFocusModeAutoFocus = 1,
AVCaptureFocusModeContinuousAutoFocus = 2,
} NS_AVAILABLE(10_7, 4_0);
5.曝光量調(diào)節(jié)
typedef NS_ENUM(NSInteger, AVCaptureExposureMode) {
AVCaptureExposureModeLocked = 0,
AVCaptureExposureModeAutoExpose = 1,
AVCaptureExposureModeContinuousAutoExposure = 2,
AVCaptureExposureModeCustom NS_ENUM_AVAILABLE_IOS(8_0) = 3,
} NS_AVAILABLE(10_7, 4_0);
6.白平衡
typedef NS_ENUM(NSInteger, AVCaptureWhiteBalanceMode) {
AVCaptureWhiteBalanceModeLocked = 0,
AVCaptureWhiteBalanceModeAutoWhiteBalance = 1,
AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance = 2,
} NS_AVAILABLE(10_7, 4_0);
7.距離調(diào)整
typedef NS_ENUM(NSInteger, AVCaptureAutoFocusRangeRestriction) {
AVCaptureAutoFocusRangeRestrictionNone = 0,
AVCaptureAutoFocusRangeRestrictionNear = 1,
AVCaptureAutoFocusRangeRestrictionFar = 2,
} NS_AVAILABLE_IOS(7_0);