简体   繁体   中英

How to create a thin scroll bar in Mac OS X Lion

How would I go about create a thin scroll bar like in the Stickies app on OSX Lion?

在此处输入图片说明

如果设置NSScroller以“小”控件的大小,无论是在IB或使用-setControlSize:是不正确的薄度?

The release notes for Lion's version of AppKit outline when overlay scrollbars are and are not used:

Unless the user overrides scrollbar appearance using System Preferences, the following behavior occurs:

  • If all of the user's pointing devices support both horizontal and vertical touch scrolling, the scrollbars are hidden during normal use. They appear as an overlay on top of the window's content while the user is scrolling, and remain visible briefly to allow scrollbar dragging.

  • If the user has at least one external pointing device that does not support scrolling, the scrollbar is displayed at all times and the usable space in the window is reduced, as in previous versions of Mac OS X. (These permanent scrollbars are referred to as legacy scrollbars.)

  • If the user has no external pointing devices attached, the trackpad settings control the scrollbar behavior; if the user has disabled scrolling for the trackpad in System Preferences, legacy scrollbars are used.

Compatibility Note: There are three situations in which legacy scrollbars are used regardless of hardware or preferences:

You should check if all the conditions are met on your machine and in your app.

You could also set the scroller style explicitly using NSScroller setScrollerStyle: , but it's probably better to respect the defaults and user preferences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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