如何让披露按钮与 BKSplitView 完美配合
我正在使用 BKToolkit
开发一个简单的应用程序,其中设置了一个公开按钮。我已将 Disclosure
按钮与 Push On Push Off
连接到 SplitView 中的 toggleCollapse:
操作。该按钮的作用是折叠并正确显示窗格。它无法正确保持其自身状态与面板外观一致。
该按钮以向上箭头开头,表示面板已打开。以下是事件的顺序:
- 我按下按钮关闭面板。披露箭头现在朝下。
- 我按下按钮以显示面板。披露箭头仍然朝下。
- 随后按该按钮不会发生任何变化。箭头仍然朝下。
第一次动画正确,那么后续按下不改变按钮的视图状态是怎么回事?
这是错误状态:
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:
- I press the button to close the panel. Disclosure arrow now faces down.
- I press the button to reveal the panel. Disclosure arrow still faces down.
- 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?
This is the erroneous state:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是控件的正常行为方式。我本想问你如何设置其状态,但看起来 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.