IPhone 设备状态、闪光灯状态

//判断闪光灯状态,修改默认的"CameraFlashOff" 按钮图片。转由 TGCameraFlash.m 控制图标切换
    AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    AVCaptureFlashMode mode = [device flashMode];
    if ([device lockForConfiguration:nil]) {
        
        switch ([device flashMode]) {
            case AVCaptureFlashModeAuto:
                mode = AVCaptureFlashModeOn;
                break;
                
            case AVCaptureFlashModeOn:
                mode = AVCaptureFlashModeOff;
                break;
                
            case AVCaptureFlashModeOff:
                mode = AVCaptureFlashModeAuto;
                break;
        }

if (device.autoFocusRangeRestrictionSupported) {
            device.autoFocusRangeRestriction = AVCaptureAutoFocusRangeRestrictionNear;
        }
        
        if (device.smoothAutoFocusSupported) {
            device.smoothAutoFocusEnabled = YES;
        }
        
        if([device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]){
            device.focusMode = AVCaptureFocusModeContinuousAutoFocus;
        }
        
        device.exposureMode = AVCaptureExposureModeContinuousAutoExposure;
        
        [device unlockForConfiguration];
    }

上一篇:Oracle ORA 12541 报错解决过程


下一篇:css系列教程--简介及基础语法和注意事项