AVCaptureDevice focusPointOfInterest 不变
我有一个带有以下代码的 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,但卡在这里,如果值不改变,观察者将无法工作。
I have an IBAction with this code:
.h file:
AVCaptureDevice *device;
.m file:
- (IBAction)focusInfo {
if (device == nil) {
device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
}
NSLog(@"Camera focus point of interest: %d, %d", device.focusPointOfInterest.x, device.focusPointOfInterest.y);
}
This is conneted to button on CustomCameraOverlay. When I am pressing the button while moving the camera nothing changes. The console log is all the time the same:
Camera focus point of interest: 0, 1071644672
Why it is not changing while camera is changing focus? What I am doing wrong? I tried also to get property isAdjustingFocus, but it is not changing as well.
I wanted to addObserwer for those properties, but stucked in here, observer won't work if value won't change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
focusPointOfInterest
的类型为CGPoint
,由CGFloat
组成。尝试使用%f
而不是%d
。focusPointOfInterest
is of typeCGPoint
, which consists ofCGFloat
s. Try%f
instead of%d
.记录 CGPoint(或其他 CGxxx 结构)时最好使用
NSStringFromCGPoint
It's better to use
NSStringFromCGPoint
when logging CGPoint (or other CGxxx structs)