I am trying to get notifications for when a property called "currentTopViewPosition" changes. I used the following code to register for the changes and receive them:
[self addObserver:self
forKeyPath:@"currentTopViewPosition"
options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld|NSKeyValueObservingOptionPrior
context:NULL];
Then the receiving side:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
NSLog(@"Key Path: %@\n change: %@",keyPath, change);
}
But nothing was getting logged for it.
I tested to make sure the value was actually changing by using an NSTimer to print out its value every 5ms and it was changing.
I've never seemed to get Key-value observing to work, so am I doing something wrong? missing a step?
Thanks!