Search code examples
iphonecamera

How can I know if the camera is focused?


I want to do this: When the camera is focused, the app will take picture automatically. But I found there's no way to detect if the camera is focused.

How can I know if the camera is focused?


Solution

  • On AVCuptureDevice you should check whether focus is supported. Not all iOS device support focusing, thus you really need to check wether focusing is supported by calling isFocusModeSupported:

    Then start monitoring the adjustingFocus property. This tells you wether the device is focusing.

    Thus while the adjustingFocus returns YES don't take the picture, if it changes into NO the device should be focused.