An instance 0xca90200 of class UILabel was deallocated while key value observers were still registered with it
一个错误,大意是UILabel被内存释放后,它得值依然在被观察
原因是给UILabel增加了个监听事件
[self.valueLabel addObserver:self
forKeyPath:@"text"
options:NSKeyValueObservingOptionNew
context:nil];
然后在UIView被pop后,监听时间没有停止,解决办法为:
- (void)dealloc
{
[_valueLabel removeObserver:self forKeyPath:@"text"];
}
网友评论