0

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.

woojtekr
  • 285
  • 1
  • 5
  • 16

2 Answers2

2

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

Dominik Seibold
  • 2,439
  • 1
  • 23
  • 29
0

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

NSLog(@"Camera focus point of interest: %@",
        NSStringFromCGPoint(device.focusPointOfInterest);
Pieter
  • 17,435
  • 8
  • 50
  • 89