gpt4 book ai didi

ios - 什么时候发布 AVCaptureDeviceSubjectAreaDidChangeNotification?

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:13:53 25 4
gpt4 key购买 nike

在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com