我正在努力模擬內置相機應用程序的基本功能。到目前爲止,我已經停留在「點擊聚焦」功能上。模擬相機應用程序的點擊重點'
我有一個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.
還記得那兩個exposurePointOfInterest和focusPointOfInterest是(0,0)和(1,1)之間的CGPoint。無論設備的方向如何,(0,0)是左上角,(1,1)是設備在右側方向的右下角。因此,使用'camera.focusPointOfInterest = location'將不會得到你想要的結果。 – 2014-01-16 23:27:24