toolbarSelectableItemIdentifiers:未调用

发布于 2024-10-02 03:44:44 字数 612 浏览 0 评论 0原文

我正在尝试制作可选择的 NSToolbarItems。我已在 IB 中正确连接所有内容,但 toolbarSelectableItemIdentifiers: 不起作用。它不会被调用。委托是文件的所有者(NSWindowController 的子类),工具栏位于工作表中。这是我的代码:

// TOOLBAR DLGT
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar {
  NSLog(@"Foo");
  NSMutableArray *arr = [[NSMutableArray alloc] init];
  for (NSToolbarItem *item in [toolbar items]) {
    [arr addObject:[item itemIdentifier]];
  }
  return [arr autorelease];
}

屏幕截图:
screenshot

你能帮我吗?


不,我不想使用 BWToolkit。

I'm trying to make selectable NSToolbarItems. I've connected everything correctly in IB, but toolbarSelectableItemIdentifiers: is not working. It doesn't get called. The delegate is the File's Owner (subclass of NSWindowController), and the toolbar is in a sheet. Here's my code:

// TOOLBAR DLGT
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar {
  NSLog(@"Foo");
  NSMutableArray *arr = [[NSMutableArray alloc] init];
  for (NSToolbarItem *item in [toolbar items]) {
    [arr addObject:[item itemIdentifier]];
  }
  return [arr autorelease];
}

Screenshot:
screenshot

Can you help me please?


No, I don't want to use BWToolkit.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美人迟暮 2024-10-09 03:44:44

您是否肯定工具栏的委托出口指向您认为它指向的类(或其实例)?那里是否调用了任何其他 NSToolbar 委托方法(足够容易测试)?

Are you positive the toolbar's delegate outlet points to the class (or instance thereof) you think it does? Are any other NSToolbar delegate methods called there (easy enough to test)?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文