加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

是否可以在objective-c中在运行时注册KVO相关键?

发布时间:2020-12-16 05:06:54 所属栏目:百科 来源:网络整理
导读:会改变(NSSet *)keyPathsForValuesAffecting Key的输出在运行时影响依赖键?换句话说,这个方法被调用的频率/时间是多少? 解决方法 the docs给我指示keyPathsForValuesAffecting Key只有在设置观察时才会调用. When an observer for the key is registered w
会改变(NSSet *)keyPathsForValuesAffecting< Key>的输出在运行时影响依赖键?换句话说,这个方法被调用的频率/时间是多少?

解决方法

the docs给我指示keyPathsForValuesAffecting< Key>只有在设置观察时才会调用.

When an observer for the key is registered with an instance of the receiving class,key-value observing itself automatically observes all of the key paths for the same instance,and sends change notifications for the key to the observer when the value for any of those key paths changes.

在许多情况下,您可以使用KVO本身来通知您的观察者keyPathsForValuesAffecting< Key>已经改变.一些自定义键的手动willChangeValueForKey和didChangeValueForKey通知将是处理动态更改键的一种方法.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读