woojtekr
woojtekr

Reputation: 295

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 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.

Upvotes: 0

Views: 1624

Answers (2)

Pieter
Pieter

Reputation: 17705

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

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

Upvotes: 0

Dominik Seibold
Dominik Seibold

Reputation: 2469

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

Upvotes: 2

Related Questions