Emulating the camera apps 'tap to focus'

Viewed 13930

I am trying hard to emulate the basic functionality of the built in camera app. Thus far I have become stuck on the 'tap to focus' feature.

I have a UIView from which I am collecting UITouch events when a single finger is tapped on the UIView. This following method is called but the camera focus & the exposure are unchanged.

-(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];
     }
}

'camera' is my AVCaptureDevice & it is non-nil. Can someone perhaps tell me where I am going wrong?

Clues & boos all welcome.

M.

1 Answers
Related