不使用时自动隐藏工具栏
我正在为 Mac OS 10.6 创建一个 Cocoa 应用程序,并且我想在至少 30 秒不使用 NSWindow 时自动隐藏它的工具栏。 我认为这可以用 NSTimers 来完成,但我对它们不熟悉,我不知道如何实现它。
另一个问题是 NSToolbarDelegate 和 NSWindowDelegate 协议都没有像 toolbarDidShow:
这样的委托方法,
有人能给我指出正确的方向吗?谢谢。
附言。这并不是为了惩罚用户,而是为用户提供一个更干净的窗口(该窗口仅包含一个用于颜色和字体的工具栏以及一个文本视图)。
聚苯硫醚。用户打字时隐藏工具栏动画会导致光标出现问题吗?
I am creating a Cocoa Application for Mac OS 10.6 >, and I want to hide the toolbar of an NSWindow automatically when it is not in use for at least 30 seconds.
I think this can be done with NSTimers, but I'm not familiar with them and I don't know how I can implement this.
Another problem is that both the NSToolbarDelegate and NSWindowDelegate protocols don't have delegate methods like toolbarDidShow:
Can anyone point me in the right direction? Thanks.
PS. This is not to punish the user, but rather give the user a cleaner window (the window consist of only a toolbar for color and font and a text-view).
PPS. Can the hide-toolbar-animation lead into a problem with the cursor while the user is typing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
计时器编程指南可能会对您有所帮助。显示和隐藏工具栏很容易,使用 -setVisible:。此外,-isVisible 可用于确定工具栏的可见性。
The Timer Programming Guide might help you here. It's easy enough to show and hide the toolbar, use -setVisible:. Also, -isVisible can be used to determine the visibility of the toolbar.