Multiple Observations
Multiple Observations
- Subject: Multiple Observations
- From: Gordon Apple <email@hidden>
- Date: Fri, 14 Jun 2013 15:06:07 -0500
- Thread-topic: Multiple Observations
- (void)awakeFromNib {
[self.doc addObserver:self
forKeyPath:@"currentPath"
options:NSKeyValueObservingOptionNew |
NSKeyValueObservingOptionOld
context:nil];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context {
if (object == self.doc && [keyPath isEqualToString:@"currentPath"] &&
self.outlineView != nil) {
[self.outlineView reloadData];
// Debugging
static NSUInteger dingCount = 0;
dingCount++;
NSLog(@"dingCount = %lu", dingCount);
}
}
³currentPath² property in doc gets set once. Observation gets dinged about
200 times. Removing the ³reloadData² didn¹t affect this. Same observer in
another file gets dinged once, like it should. Stack trace always leads
back to where "currentPath" is set in doc. Any theories on what could cause
this observer to have diarrhea?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden