通知
KVO( Key-Value Observing)
NSString *value = [NSStringstringWithFormat:@"%d",(int)_mySlider.value];
NSLog(@"%@",[selfvalueForKeyPath:@"myTxt.text"]);
NSString *keyPath = @"myTxts.text";
[ self setValue :value forKeyPath :keyPath];
KVC( Key-Value Coding)
===========1:
// 加一个检测textFiled 的
[self addObserver:selfforKeyPath:@"myTxt.text"options:
NSKeyValueObservingOptionOld || NSKeyValueObservingOptionNew context:nil];
===========2:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
NSLog(@"1");
NSLog(@"%@",change);
}
适配器模式
协议