KVO in the array of childViewControllers UIViewController

Using accessors seems to be a way to get KVO notifications about collection objects, but this does not work on the childViewControllers NSArray UIViewController property. I want to be notified when an object is added or removed to this property. So I tried this:

[self addObserver:self forKeyPath:@"childViewControllers" options:NSKeyValueObservingOptionNew context:nil];

-(NSUInteger)countOfChildViewControllers
{
    return self.childViewControllers.count;
}

But I'm not sure that I am doing it right, I do not receive any notifications. I want this to be possible?

+5
source share
1 answer

, KVO- . , UIViewController , . - UIViewController KVO-, . , KVO; , , , . , .

0

All Articles