kvo-block-binding
kvo-block-binding copied to clipboard
Example doesn't work any more
The provided example doesn't compile out of the box. After adding missing files to the project it still fails at runtime with:
2013-03-01 12:12:32.071 KVOBlockBindingExample[69343:11303] -[KVOBlockBindingViewController bind:keyPath:to:keyPath:addReverseBinding:]: unrecognized selector sent to instance 0x7564cd0
2013-03-01 12:12:32.078 KVOBlockBindingExample[69343:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[KVOBlockBindingViewController bind:keyPath:to:keyPath:addReverseBinding:]: unrecognized selector sent to instance 0x7564cd0'
+1 it's because of the nonexistent methods...
-(void)twoWayBinding
{
[self bind:stepper1 keyPath:@"value" to:stepper2 keyPath:@"value" addReverseBinding:YES];
// add one way blocks to observe the stepper values
[self observe:stepper1 keyPath:@"value" block:^(id observed, NSDictionary *change) {
stepper1Label.text = [NSString stringWithFormat:@"%1.0f",stepper1.value];
}];
[self observe:stepper2 keyPath:@"value" block:^(id observed, NSDictionary *change) {
stepper2Label.text = [NSString stringWithFormat:@"%1.0f",stepper2.value];
}];
}
etc