如何在滚动条中包含其他控件?

发布于 2024-08-29 02:13:04 字数 190 浏览 15 评论 0原文

我想创建一个带有缩放控件和滚动条旁边的按钮的滚动视图。有点像 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 技术交流群。

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

发布评论

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

评论(1

左耳近心 2024-09-05 02:13:04

子类 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.

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