在Apple的示例代码“AVCam”中,AVCaptureDeviceSubjectAreaDidChangeNotification被添加到NSNotificationCenter,但在我的测试中从不调用其回调“subjectAreaDidChange”。我想知道这个通知何时会被系统发布?
通过以下代码添加:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(subjectAreaDidChange:)
name:AVCaptureDeviceSubjectAreaDidChangeNotification
object:[[self videoDeviceInput] device]];
AVFoundation的头文件AVCaptureDevice.h如下:
@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.
这就是我的全部问题。非常感谢你。
答案 0 :(得分:1)
你有没有设置
[[self videoDeviceInput] device] .subjectAreaChangeMonitoringEnabled = YES;