kvc原来是 其它技术的基础,

kvc 是kvo的基础,是core data的基础,并不是说 单纯kvc比 直接用.访问好处多了多少,
NSManagedObject *character; //Lets assume the core data object has been fetched. //Giving the object some values to save later. [character setValue:@"Sakura Kinomoto" forKey:@"characterName"]; [character setValue:38 forKey:@"ownedCards"]; //Fetching those values using KVC. NSString *sakura = [character valueForKey:@"characterName"]; NSInteger numberOfClowCards = [character valueForKey:@"ownedCards"];

 Key-value coding is a fundamental technology when working with key-value observing, Cocoa bindings, Core Data, and making your application AppleScript-able. You are expected to be familiar with the basics of Cocoa development and the Objective-C language.

 

posted @ 2013-12-17 18:19  路在脚下,  阅读(255)  评论(0编辑  收藏  举报