覆盖NSScroller内容 [英] Overlay NSScroller over content
问题描述
有什么方法可以覆盖NSScroller 超过滚动视图的内容(如在iOS中)?我已经尝试了几种方法:
a)设置滚动视图内容视图(NSClipView)的框架,
b)添加NSScroller对象作为滚动视图的子视图(位于我想要的位置)< b
c)创建一个完全自定义的滚动视图并将它放置为一个子视图(这个工作,但这意味着我需要重写NSScroller的所有功能) p>
Sparrow 似乎成功地做到了这一点,它似乎通过一个正常的NSScroller子类(看到它响应在系统偏好设置>>外观中设置的滚动设置)。
任何建议都可以使用: - )
之后,通过覆盖 NSScrollView code>,你会得到他们正确放置。
Is there any way to overlay the NSScroller over the content of the scroll view (like in iOS)? I've already tried several approaches:
a) setting the frame of the scroll view content view (NSClipView) to extend into the bounds of the scroller
b) adding an NSScroller object as a subview of the scroll view (positioned where I want)
c) creating an entirely custom scroller view and placing it as a subview (this worked, but that would mean that I need to rewrite all the functionality of NSScroller)
Sparrow seems to successfully do this, and it seems to do it through a regular NSScroller subclass (seeing as it responds to the scroll settings set in System Preferences >> Appearance). It's not really drawing the scroller that's the issue, its just making it overlay the content.
Any advice is appreciated :-)
Here's where you can set the custom class of your scrollbars.
After that, by overriding the -tile
method of NSScrollView
, you'll get them placed properly.
这篇关于覆盖NSScroller内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!