title: How to make a method to detect if a variable changed?
body: <p>I declared <code>@property (strong, nonatomic) NSString *data;</code> in the h file, and pass an <code>NSString</code> from another class to "data". I want to detect if "data" is updated so I tried the code below but it doesn't work.</p>
  
  <pre><code>-(void)didChangeValueForKey:(NSString *)key {  
  
      [super didChangeValueForKey:key];
      if ( [key isEqualToString:@"data"] ) {
          // do something     
      }
  }
  </code></pre>
  
  <p>Anyone know how to figure this out?</p>
  
  <p>Thank you and sorry for my English.</p>