开发者

Observe property of a custom view from Window Controller in Cocoa KVO

This is the hierarchy of my application, where i need to observe a property:

ObjectA
   |
   |-----windowControllerA (NSWindowController)
              |
              |-------Content(NSWindow)
                          |
                          |--------contentView (Custom NSView)
                                         |
                                         |---- propertyX (property to observe)

I try to observe from ObjectA with this code: [self.windowControllerA addObserver:self forKeyPath:@"self.content.contentView.property" options:NSKeyValueObservingOptionOld context:@"context"];

But it doesn't work, i get this error : was se开发者_如何学编程nt to an object that is not KVC-compliant for the "content" property.

What i have to do to observe propertyX from ObjectA ?


I found the problem! this's the right path "window.contentView.property"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜