美文网首页
KVO 的限制

KVO 的限制

作者: 骑着老鼠虐大象 | 来源:发表于2016-09-11 14:44 被阅读24次

    上一篇中讲到 观察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 观察不到;

    相关文章

      网友评论

          本文标题:KVO 的限制

          本文链接:https://www.haomeiwen.com/subject/bkuuettx.html