KVO 的限制

上一篇中讲到 观察NSArray 崩溃 ,看了一下文档,上面这样讲

NSArray objects are not observable, so this method raises an exception when invoked on an NSArray object. Instead of observing an array, observe the to-many relationship for which the array is the collection of related objects.

猜想 NSSet也会如此,果不其然

NSSet objects are not observable, so this method raises an exception when invoked on an NSSet object. Instead of observing a set, observe the unordered to-many relationship for which the set is the collection of related objects.

KVO 的本质是重写set方法,所以_xx=@"buasbuc"  KVO 观察不到;

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 五一回家,看到临近高考的妹妹依然在努力地奋斗中,从进入高三,尤其是这一学期,见她每日都起早贪黑、奋笔疾书地学习,桌...
    安夏如默阅读 3,089评论 0 1