Cocoa Binding,如何询问“视图”?滚动到选择的一侧

发布于 2024-08-20 19:11:33 字数 186 浏览 3 评论 0原文

目前,我将 NSArray 绑定到 NSArrayController,然后绑定到 NSTableView,因此数据和选择工作正常,但似乎我无法告诉表视图滚动到 NSArrayController 中的选择。我必须添加 NSTableView 出口吗?

我当然可以做到这一点,但我会尝试看看是否有更好的方法来避免将 UI 控件引入到控制器端。

Currently, I'm binding the NSArray to NSArrayController and then to a NSTableView, so the data and selection is working correctly, but seems I can't tell table view to scroll to selection from NSArrayController. Do I have to add an NSTableView outlet?

I certainly can do that, but I'd try to see if there's a better way to avoid introducing UI controls to Controller side.

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

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

发布评论

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

评论(1

ゝ杯具 2024-08-27 19:11:33

控制器的工作是坐在模型和视图之间,并根据需要与它们进行对话。这意味着,是的,您必须让控制器知道视图;这是必要的,也是适当的。

The job of the Controller is to sit between the Model and View and talk to both of them as needed. This means that, yes, you will have to make the Controller know of the View; this is both necessary and appropriate.

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