本地监听的使用

//为tempURL添加一个监听。
    [self addObserver:self forKeyPath:@"tempURL" options:NSKeyValueObservingOptionNew context:nil];


-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
    [self.liShiDict setObject:self.tempURL forKey:self.tempTitle];
}

上面的操作就  实现了: 当属性 tempURL 变化的时候,就促发下面的方法。。

猜你喜欢

转载自zhangmingwei.iteye.com/blog/1837852