KVO 的限制

2016-09-11  本文已影响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 观察不到;

上一篇 下一篇

猜你喜欢

热点阅读