Im trying to subclass a NSOperation, and read some sample from, they say: when the task finished, using KVO of NSOperation, to finish the operation, code here:
[self willChangeValueForKey:@"isFinished"];
[self willChangeValueForKey:@"isExecuting"]
finished = YES;
executing = NO;
[self didChangeValueForKey:@"isFinished"];
[self didChangeValueForKey:@"isExecuting"];
then isFinished get called
- (BOOL) isFinished{
return(finished);
}
anyone could explain this to me? why isFinished gets called, will the isFinished finish the operation? as I understanded, do KVO manually need [self didChangeValueForKey:@"isExecuting"]; and I didnt see code like addobserver: and observeValueForKeyPath:
I write
-(void)call
{
[self willChangeValueForKey:@"isVip"];
[self didChangeValueForKey:@"isVip"];
}
-(void)isVip
{
NSLog(@"Im vip");
}
isVip is not called when do [self call];