Skip to content

Instantly share code, notes, and snippets.

@tempos21ios
Created April 15, 2013 06:53
Show Gist options
  • Save tempos21ios/5386204 to your computer and use it in GitHub Desktop.
Save tempos21ios/5386204 to your computer and use it in GitHub Desktop.
Ejemplo KVO
//Vamos a observar la propiedad cartUnits del objeto _product
[_product addObserver:self forKeyPath:@"cartUnits" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if([keyPath isEqualToString:@"cartUnits"])
{
//Acción
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment