我很困惑!
我正在尝试手动调整曝光以适应预览中心的 CGPoint。我正在使用设备对象并使用 setExposureMode 和 setExposurePointOfInterest 来进行操作。我要做的第一件事是检查设备是否支持曝光模式。如果不支持,则返回。如果支持,则设置值。我的困惑源于设备 isExposureModeSupported:exposureMode 的值返回 NO。但是支持!我有一部 iPhone 5c。如果我忽略 return 语句,我不会收到任何错误。
- (void)device:(AVCaptureDevice *)device exposureMode:(AVCaptureExposureMode)exposureMode atPoint:(CGPoint)point
{
BOOL exposureModeSupported = [device isExposureModeSupported:exposureMode];
if (!exposureModeSupported)
return;
if ([device lockForConfiguration:&error]) {
[device setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
[device setExposurePointOfInterest:point];
CALayer *exposeRect = [CALayer layer];
exposeRect.frame = CGRectMake(self.center.x-30, self.center.y-30, 60, 60);
exposeRect.borderColor = [UIColor whiteColor].CGColor;
exposeRect.borderWidth = 2;
exposeRect.name = @"exposeRect";
[self.previewLayer addSublayer:exposeRect];
[NSTimer scheduledTimerWithTimeInterval: 1
target: self
selector: @selector(dismissExposeRect)
userInfo: nil
repeats: NO];
[device setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
[device unlockForConfiguration];
}
}
如果我不能信任返回的值,如何检查是否支持曝光模式?
我结束了检查,但我不确定这是正确的检查方法。现在的情况如下所示:
if (![device isExposurePointOfInterestSupported] && ![device isExposureModeSupported:exposureMode])
return;
有没有其他人遇到过这个,有没有人知道如何正确处理这个?
先感谢您。