相关疑难解决方法(0)

iOS:将观察者添加到UIView的frame.origin.y?

我正在试图监视和回应UIView框架原点的变化值.我的代码:

[cell.bottomView addObserver:self forKeyPath:@"frame.origin" options:NSKeyValueObservingOptionNew context:NULL];

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    NSLog(@"%@ Changed", keyPath);
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误消息,我不明白:

An instance 0x7587d10 of class NSConcreteValue was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info:
<NSKeyValueObservationInfo 0x7587fd0> (
<NSKeyValueObservance 0x7587f70: Observer: 0x7587bd0, Key path: origin, Options: <New: YES, Old: …
Run Code Online (Sandbox Code Playgroud)

frame ios

11
推荐指数
2
解决办法
7016
查看次数

标签 统计

frame ×1

ios ×1