Domanda

I'm trying to tell the camera in my app (which is build around OpenFrameworks) to auto focus. After reading this SO post I read through the AV Foundation Programming Guide on how to set the focus mode. The code they give as an example is:

if ([currentDevice isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) {
    CGPoint exposurePoint = CGPointMake(0.5f, 0.5f);
    [currentDevice setExposurePointOfInterest:exposurePoint];
    [currentDevice setExposureMode:AVCaptureExposureModeContinuousAutoExposure];
}

I haven't been able to figure out how to initialize currentDevice outside the if statement, and it's not in the documentation. How should it be initialized/what type is it? Thanks.

È stato utile?

Soluzione

You can read more about the AVCaptureDevice Class Reference

It refers to front or the back side camera. And don't forget to import the AVFoundation.framework

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top