some feelings about Kvo. KVO (key value observing) key-value listener usage scenario: When a property of Class B changes, the properties in Class A are changed. How to use: A to listen to B in Class A introduced in Class B. h file defines a Class B object B for B to add listener [b addobserver:self forkeypath:@ "B Properties" options: Nskeyvalueobservingoptionnew Context:nil]; Override callback listener Method-(void) Observevalueforkeypath: (NSString *) KeyPath OfObject: ( ID) object changed: (nsdictionary *) Change context: (void*) context{here modifies the value of the corresponding Class A property. Where the object being modified is the property modified by object is [change objectforkey:@ "new"] the content being modified is context}
Finally, don't forget to delete the listener.
-(void) dealloc{[b removeobserver:self forkeypath:@ "B's Attribute"];}
Some feelings about KVO.