Why should I use KVC rather than the simple dot syntax when accessing object properties?
问题 There's the option to go the long way, if an receiver class conforms to the NSKeyValueProtocol: [myInstance setValue:[NSNumber numberWithInt:2] forKey:@"integerProperty"]; or the short way: myInstance.integerProperty = 2; what's the point of this KVC method? When is this useful? 回答1: First, those aren't the same, the second should be: myInstance.integerProperty = [NSNumber numbwerWithInt:2]; if integerProperty is an NSNumber . In general you use the second form when you are doing the most