在uiimagepickerviewcontroller中停止自动对焦

时间:2013-07-31 11:09:46

标签: cocoa-touch uiimagepickercontroller

如何在iPhone sdk的UIimagepickercontroller相机中停止自动对焦?

2 个答案:

答案 0 :(得分:0)

showsCameraControls设置为NO,如下所示..

picker.showsCameraControls = NO;

另请参阅此链接的另一个答案iphone-ios-4-3-camera-focus-square-removeable-programatically

答案 1 :(得分:-2)

您可能想尝试锁定焦点以禁用自动对焦。以下是示例代码:

 NSArray *devices = [AVCaptureDevice devices];
    NSError *error;
    for (AVCaptureDevice *device in devices) {
        if (([device hasMediaType:AVMediaTypeVideo]) && 
            ([device position] == AVCaptureDevicePositionBack) ) {
            [device lockForConfiguration:&error];
             if ([device isFocusModeSupported:AVCaptureFocusModeLocked]) {
             device.focusMode = AVCaptureFocusModeLocked;
             NSLog(@"Focus locked");
             }

            [device unlockForConfiguration];
        }
    }

此外,你可以尝试将你的选择器控制器的.showsCameraControls属性设置为NO应该移除焦点方块(它在4.3之前做过,我认为没有任何改变),但缺点是你需要提供你自己的控制(拍照等)。