iOS:AVFoundation:焦点

时间:2014-09-05 16:49:26

标签: ios camera avfoundation autofocus

自动对焦完成后,是否有办法随时获得对焦点?

在Apple的示例代码中,他们使用:

    - (void)subjectAreaDidChange:(NSNotification *)notification

{

     CGPoint devicePoint = CGPointMake(.5, .5);

     [self focusWithMode:AVCaptureFocusModeContinuousAutoFocus exposeWithMode:AVCaptureExposureModeContinuousAutoExposure atDevicePoint:devicePoint monitorSubjectAreaChange:NO];

}

以上代码仅适用于“点击以关注”。它还会强制相机对焦在屏幕中央。我想在自动对焦完成后立即获得对焦点。

1 个答案:

答案 0 :(得分:3)

看起来您只需阅读focusPointOfInterest属性即可获得当前焦点:

- (void)subjectAreaDidChange:(NSNotification *)notification
{
     CGPoint devicePoint = device.focusPointOfInterest;
}