如何在滚动条中包含其他控件?
我想创建一个带有缩放控件和滚动条旁边的按钮的滚动视图。有点像 XCode 中的“平铺窗口”按钮(编辑器的右上角),它应该位于通常仅由滚动条使用的同一个框中。
您知道如何解决这个问题吗?
我正在考虑使用 NSScrollView 并将滚动条设置为 NSScroller 的自定义子类,其中包括其他小部件。哪些按钮使用与滚动条相同的样式?
I want to create a scrollview with a zooming control and a button next to the scrollbar. Sort of like the "tile window" button in XCode (top right corner of the editor), it should be in the same box that usually is used by the scrollbar only.
Do you have an idea of how to approach this?
I was thinking to use an NSScrollView
and set the scrollbars to a custom subclass of NSScroller
which includes the other widgets. What kinds of buttons use the same style as the scrollbar?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
子类
NSScrollView
并覆盖-tile
。您将在 -init... 或 nib awake(或其他方便的时间)上添加子视图,并在重写的-tile
方法中手动布置控件。如果您先调用[超级图块],然后调整底部或右侧滚动条为您的自定义控件腾出空间,您的工作会容易得多。Subclass
NSScrollView
and override-tile
. You'll add the subviews on -init... or nib awake (or some other convenient time) and lay out the controls manually in your overridden-tile
method. If you call [super tile] first, then adjust the bottom or right scroll bar to make room for your custom control(s), your job will be a lot easier.