我有一个带有此代码的 IBAction:
.h 文件:
AVCaptureDevice *device;
.m 文件:
- (IBAction)focusInfo {
if (device == nil) {
device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
}
NSLog(@"Camera focus point of interest: %d, %d", device.focusPointOfInterest.x, device.focusPointOfInterest.y);
}
这与 CustomCameraOverlay 上的按钮有关。当我在移动相机的同时按下按钮时,没有任何变化。控制台日志始终相同:
Camera focus point of interest: 0, 1071644672
为什么相机改变焦点时它没有改变?我做错了什么?我也尝试获取属性 isAdjustingFocus,但它也没有改变。
我想为这些属性添加Obserwer,但卡在这里,如果值不会改变,观察者将无法工作。