1

我有一个NSOutlineView使用NSTreeController. 树控制器管理具有属性的数组,NSMutableDictionary包括:NSString *name, and NSArray* children.

name当UI 发生变化时,如何获得通知?

4

1 回答 1

0

只需将一个函数放入 NSOutlineView 的委托中

- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
{
    // for example that is checked that node text is not empty
    if ([[fieldEditor string] length] == 0)
    {
        return NO;
    }
    else
    {
        return YES;
    }
}
于 2012-04-09T18:19:04.353 回答