如何让披露按钮与 BKSplitView 完美配合

发布于 2024-10-13 07:21:15 字数 553 浏览 8 评论 0原文

我正在使用 BKToolkit 开发一个简单的应用程序,其中设置了一个公开按钮。我已将 Disclosure 按钮与 Push On Push Off 连接到 SplitView 中的 toggleCollapse: 操作。该按钮的作用是折叠并正确显示窗格。它无法正确保持其自身状态与面板外观一致。

该按钮以向上箭头开头,表示面板已打开。以下是事件的顺序:

  1. 我按下按钮关闭面板。披露箭头现在朝下。
  2. 我按下按钮以显示面板。披露箭头仍然朝下
  3. 随后按该按钮不会发生任何变化。箭头仍然朝下。

第一次动画正确,那么后续按下不改变按钮的视图状态是怎么回事?

替代文字 alt text

这是错误状态:

I have a disclosure button setup in a simple app I am working on that is using BKToolkit. I have hooked up a Disclosure button with Push On Push Off to the toggleCollapse: action in the SplitView. The button works in the aspect that it collapses and reveals the pane correctly. It does not work correctly to hold its own state consistent with the panels appearance.

The button starts with an upwards arrow to show the panel is open. Here is the sequence of events:

  1. I press the button to close the panel. Disclosure arrow now faces down.
  2. I press the button to reveal the panel. Disclosure arrow still faces down.
  3. Any subsequent presses to the button change nothing. The arrow still faces down.

It animates correctly the first time so what is up the subsequent presses not changing the view state of the button?

alt text
alt text

This is the erroneous state:

alt text

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

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

发布评论

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

评论(1

无法回应 2024-10-20 07:21:15

这不是控件的正常行为方式。我本想问你如何设置其状态,但看起来 BKToolkit 中的分割视图控件记录了第一个向其发送切换消息的发件人,并随后管理该发件人的状态。

例如,如果您有一个菜单项也调用此切换行为,并且一直使用它来测试切换,这可能是一个问题。在这种情况下,按钮的状态不会更新。

我没有看到一个简单的解决方案,因为这种行为是硬连接在 BKToolkit 拆分视图的代码中的。也许您的控件应该在应用程序的控制器之一中调用您自己的切换方法,直接设置折叠状态(以便所有内容都同意状态)并自行管理所有 UI 状态。

This is not how the control behaves normally. I was going to ask how you're setting its state but it looks like the split view control in BKToolkit records the first sender to send it the toggle message and manages that sender's state thereafter.

This could be a problem, for instance, if you've got a menu item calling this toggle behavior as well and have been using that to test the toggling. In this case, your button's state wouldn't be updated.

I don't see an easy solution since this behavior is hard wired in the BKToolkit split view's code. Perhaps your controls should call your own toggle method in one of your app's controllers, setting the collapse state directly (so everything agrees on state) and managing all your UI's state yourself.

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