在 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.
这就是我的全部问题。非常感谢。
最佳答案
你设置了吗
[[self videoDeviceInput] device].subjectAreaChangeMonitoringEnabled = YES;
关于ios - 什么时候发布 AVCaptureDeviceSubjectAreaDidChangeNotification?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32582972/