鍵值編碼的優點:
- 基于配置的屬性訪問。
- 降低耦合性。
- 簡化代碼。
使用鍵值編碼更新模型的狀態。
- (void) updateModel(NSString *)value forState:(NSString)state {
[self setValue:value forKey:state];
}
鍵值編碼的優點:
- (void) updateModel(NSString *)value forState:(NSString)state {
[self setValue:value forKey:state];
}