gpt4 book ai didi

cocoa - NSOutlineView 轮廓 View SelectionDidChange

转载 作者:行者123 更新时间:2023-12-03 16:32:58 28 4
gpt4 key购买 nike

我的 NSOutlineView OutlineViewSelectionDidChange 方法将不会被调用。我将 NSOutlineViews 委托(delegate)设置为其他方法所在的类,例如

- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item

存在。但是在选择项目时不会调用outlineViewSelectionDidChange。有人有想法吗?

最佳答案

此通知有点奇怪,因为它不会自动转发给委托(delegate)。尝试在初始化代码中添加显式注册,如下例所示:

- (void)windowControllerDidLoadNib:(NSWindowController *)aController;
{
[super windowControllerDidLoadNib:aController];
NSNotificationCenter * center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(outlineViewSelectionDidChange:)
name:@"NSOutlineViewSelectionDidChangeNotification"
object:outlineView];
}

关于cocoa - NSOutlineView 轮廓 View SelectionDidChange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7518917/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com