2014-09-05 80 views
2

自動對焦完成後,有沒有辦法在任何時候獲得對焦點?iOS:AVFoundation:Focus Point

在蘋果的示例代碼,他們使用:

- (void)subjectAreaDidChange:(NSNotification *)notification 

{ 

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

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

} 

上面的代碼工作只需「點擊關注」。它也強制相機對焦在屏幕中央。我想在自動對焦完成後隨時獲得對焦點。

回答

3

看起來你可以只讀取focusPointOfInterest屬性來獲取當前焦點:

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