在iOS中设置相机曝光点的正确方法

时间:2012-10-04 11:57:27

标签: iphone ios5 camera iphone-4

我正在尝试在iOS 5(iPhone 4s测试设备)中设置相机曝光点:

if ([_videoDevice lockForConfiguration:nil])
{
    if ([_videoDevice isExposurePointOfInterestSupported])
    {
        [_videoDevice setExposurePointOfInterest:CGPointMake(0.2,0.2)];

        if ([_videoDevice isExposureModeSupported:AVCaptureExposureModeAutoExpose])
        {
            [_videoDevice setExposureMode:AVCaptureExposureModeAutoExpose];
            NSLog(@"Adjusting exposure: %d", [_videoDevice isAdjustingExposure]);
        }
    }
    [_videoDevice unlockForConfiguration];
}

根据文档“AVCaptureExposureModeAutoExpose”应设置曝光然后锁定。我的问题是“isAdjustingExposure”总是返回false。我甚至试图设置一些睡眠,但它仍处于假状态。

如何正确设置曝光点?

此致

1 个答案:

答案 0 :(得分:1)

诀窍是设置“AVCaptureExposureModeContinuousAutoExposure”并使用键/值观察。