Student *stu = [stu setAge:= ;
IndirectModify Object Attributes
ValueForKey:AndSetValue: ForKey:Send messages to objects in string Mode
******************************** <Foundation/Foundation.h>
<Foundation/Foundation.h> age; @property (nonatomic,copy) NSString *name; @property (nonatomic,retain) Book *book; - (
- (*stu = [stu setValue: forKey:*str = [stu valueForKey:]; [stu setValue:@ forKey: age = [[stu valueForKey:] intValue]; ,str,age); [stu @{:@,: NSDictionary *dic = [stu :@[,,dic); stu.book =
[stu.book setPrice:]; [stu.book setValue:@ forKey:]; [stu setValue:@ forKeyPath:]; [stu.book setValue:@ forKeyPath:]; }
2. KVO (Key Value Observing)
Implementation Method: Add listeners
<Foundation/Foundation.h>*- (
- (*stu = [stu setValue: forKey: Teacher *teacher = [stu addObserver:teacher forKeyPath: options:NSKeyValueObservingOptionNew context:nil]; stu.name = }
<Foundation/Foundation.h>
- ()observeValueForKeyPath:(NSString *)keyPath ofObject:() change:(NSDictionary *)change context:( *,keyPath); NSLog(,); NSLog(,change);
<Foundation/Foundation.h> main( argc, * Student *stu =