0

我有一个带有此代码的 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,但卡在这里,如果值不会改变,观察者将无法工作。

4

2 回答 2

2

focusPointOfInterest是 类型CGPoint,由CGFloats 组成。尝试%f代替%d.

于 2011-01-19T04:20:52.860 回答
0

NSStringFromCGPoint记录 CGPoint(或其他 CGxxx 结构)时最好使用

NSLog(@"Camera focus point of interest: %@",
        NSStringFromCGPoint(device.focusPointOfInterest);
于 2015-11-02T09:47:25.650 回答