UIViewController
当视图变得可见时,子类上有一个属性会发生变化。(一组不再为空。)我已经实现了 KVC/KVO,如下所示:
- (void)viewWillAppear:(BOOL)animated {
[self willChangeValueForKey:@"anticipatedIndexPaths" withSetMutation:NSKeyValueSetSetMutation usingObjects:_anticipatedIndexPaths];
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
assert([_anticipatedIndexPaths count]);
[self didChangeValueForKey:@"anticipatedIndexPaths" withSetMutation:NSKeyValueSetSetMutation usingObjects:_anticipatedIndexPaths];
}
该类的一个子类正在观察自身 for @"anticipatedIndexPaths"
,但NSKeyValueChangeNewKey
观察时的值NSKeyValueChangeReplacement
始终是一个空集。是什么赋予了?