简体   繁体   English

如何使用Cocoa制作按钮滚动条(按钮栏)?

[英]How to make a scrolling bar of buttons (buttons bar) with Cocoa?

I would like to have buttons inside a scroll view (or another solution to creating a scrollable button bar). 我想在滚动视图中包含按钮(或创建滚动按钮栏的另一种解决方案)。

I have buttons placed side by side in a row along the top of a view. 我沿着视图的顶部并排放置按钮。 As a user resizes the window to be less wide, fewer buttons can be seen. 当用户将窗口调整为较小的宽度时,可以看到较少的按钮。

When all the buttons cannot be viewed, I would like the user to still be able to access all the buttons by scrolling horizontally through them. 当所有按钮都无法查看时,我希望用户仍然可以通过水平滚动它们来访问所有按钮。

To visualise this, imagine in Safari if you open too many tabs to fit in the window - I would like the user to be able to scroll to the right and reveal the tabs that weren't on the screen. 为了实现这一点,请想象一下在Safari中打开的标签页是否太多,以至于无法容纳在窗口中-我希望用户能够向右滚动并显示屏幕上未显示的标签页。

您需要在自动调整大小设置器中取消选择弹簧(用于滚动器的自定义视图),以便在调整大小时该视图不会随滚动视图一起收缩。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM