开发者

AVCaptureDevice focusPointOfInterest doesn't change

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 is开发者_开发知识库AdjustingFocus, 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.


focusPointOfInterest is of type CGPoint, which consists ofCGFloats. Try %f instead of %d.


It's better to use NSStringFromCGPoint when logging CGPoint (or other CGxxx structs)

NSLog(@"Camera focus point of interest: %@",
        NSStringFromCGPoint(device.focusPointOfInterest);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜