If I wanted to write my own KVO-compliant setter method, would it look something like this?

Posted by mystify on Stack Overflow See other posts from Stack Overflow or by mystify
Published on 2010-06-08T10:59:35Z Indexed on 2010/06/08 11:02 UTC
Read the original article Hit count: 184

Filed under:
|
- (void)setFirstName:(NSString*)firstNameValue {
    [self willChangeValueForKey:@"firstName"];
    [firstName release];
    firstName = firstNameValue;
    [firstName retain];
    [self didChangeValueForKey:@"firstName"];
}

Is that right? So the willChange... foobar didChange... block causes an KVO notification to fire?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about kvo