我想使用 UIImagePicker 禁用相机应用程序的自动对焦,并且与前置摄像头一样工作而无需对焦。有人可以帮我吗?
我已经使用了这个代码,但只有方形框被隐藏了,但仍然专注......
-(void)disableAutoFocus
{
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];
}
}
}