NSCell KVO监测突出显示

时间:2014-11-10 10:28:23

标签: cocoa key-value-observing nsbutton nscell

我想监视按钮单元格突出显示状态,但回调永远不会调用,尽管突出显示会更改

监控keyPath“状态”有效,但为什么不监控突出显示?

- (void)awakeFromNib {

    [super awakeFromNib];

    [self.cell addObserver:self
              forKeyPath:@"highlighted"
                 options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
                 context:NULL];


}

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context
{


    ...

}

0 个答案:

没有答案