2015-09-15 2 views
3

В примере кода Apple «AVCam», AVCaptureDeviceSubjectAreaDidChangeNotification добавляется в NSNotificationCenter, но его callback «subjectAreaDidChange» никогда не вызывается в моем тесте. Интересно, когда это уведомление будет опубликовано системой?Когда будет опубликован AVCaptureDeviceSubjectAreaDidChangeNotification?

Он добавил следующий код:

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(subjectAreaDidChange:) 
              name:AVCaptureDeviceSubjectAreaDidChangeNotification 
              object:[[self videoDeviceInput] device]]; 

И заголовочный файл AVCaptureDevice.h из AVFoundation выглядит следующим образом:

@constant AVCaptureDeviceSubjectAreaDidChangeNotification 
@abstract 
    Posted when the instance of AVCaptureDevice has detected a substantial change to the 
    video subject area. 
@discussion 
    Clients may observe the AVCaptureDeviceSubjectAreaDidChangeNotification to know when an 
    instance of AVCaptureDevice has detected a substantial change to the video subject area. 
    This notification is only sent if you first set subjectAreaChangeMonitoringEnabled to 
    YES. 

Это все мой вопрос. Большое спасибо.

ответ

1

ли вы установили

[[само videoDeviceInput] устройство] .subjectAreaChangeMonitoringEnabled = YES;