我正在努力模拟内置相机应用程序的基本功能。到目前为止,我一直停留在“点击对焦”功能上。
我有一个 UIView,当单指点击 UIView 时,我正在收集 UITouch 事件。调用以下方法,但相机焦点和曝光不变。
-(void)handleFocus:(UITouch*)touch
{
if( [camera lockForConfiguration:nil] )
{
CGPoint location = [touch locationInView:cameraView];
if( [camera isFocusPointOfInterestSupported] )
camera.focusPointOfInterest = location;
if( [camera isExposurePointOfInterestSupported] )
camera.exposurePointOfInterest = location;
[camera unlockForConfiguration];
[cameraView animFocus:location];
}
}
“相机”是我的 AVCaptureDevice,它不是零。有人可以告诉我哪里出错了吗?
欢迎提供线索和嘘声。
M。