質問

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.

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top