Skip to content

Instantly share code, notes, and snippets.

@jlcampana
Created September 4, 2012 07:37
Show Gist options
  • Select an option

  • Save jlcampana/3618043 to your computer and use it in GitHub Desktop.

Select an option

Save jlcampana/3618043 to your computer and use it in GitHub Desktop.
KVO (ejemplo)
//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