Class

NSScroll​View

The NSScroll​View class is the central coordinator for the Application Kit’s scrolling machinery, composed of this class, and the NSClip​View, and NSScroller classes. A scroll view displays a portion of a document view that’s too large to be displayed whole and provides scroll bars that allow the user to move the document view within the scroll view.

Overview

Note that, when using an NSClip​View object within an scroll view (the usual configuration), you should issue messages that control background drawing state to the scroll view directly, rather than messaging the clip view.

Symbols

Determining Component Sizes

var content​Size:​ NSSize

The size of the scroll view’s content view.

var document​Visible​Rect:​ NSRect

The portion of the document view, in its own coordinate system, visible through the scroll view’s content view.

Managing Graphics Attributes

var background​Color:​ NSColor

The color of the content view’s background.

var draws​Background:​ Bool

A Boolean that indicates whether the scroll view draws its background.

var border​Type:​ NSBorder​Type

A value that specifies the appearance of the scroll view’s border.

var document​Cursor:​ NSCursor?

The content view’s document cursor.

Managing the Views

var content​View:​ NSClip​View

The scroll view’s content view, the view that clips the document view.

var document​View:​ NSView?

The view the scroll view scrolls within its content view.

Managing Scrollers

var horizontal​Scroller:​ NSScroller?

The scroll view’s horizontal scroller.

var has​Horizontal​Scroller:​ Bool

A Boolean that indicates whether the scroll view has a horizontal scroller.

var vertical​Scroller:​ NSScroller?

The scroll view’s vertical scroller.

var has​Vertical​Scroller:​ Bool

A Boolean that indicates whether the scroll view has a vertical scroller.

var autohides​Scrollers:​ Bool

A Boolean that indicates whether the scroll view automatically hides its scroll bars when they are not needed.

Managing Rulers

class func set​Ruler​View​Class(Any​Class?)

Sets the default class to be used for ruler objects in NSScrollViews to a​Class.

class func ruler​View​Class()

Returns the default class to be used for ruler objects in NSScrollViews.

var has​Horizontal​Ruler:​ Bool

A Boolean that indicates whether the scroll view keeps a horizontal ruler object.

var horizontal​Ruler​View:​ NSRuler​View?

The scroll view’s horizontal ruler view.

var has​Vertical​Ruler:​ Bool

A Boolean that indicates whether the scroll view keeps a vertical ruler object.

var vertical​Ruler​View:​ NSRuler​View?

The scroll view’s vertical ruler view.

var rulers​Visible:​ Bool

A Boolean that indicates whether the scroll view displays its rulers.

Managing Insets

var automatically​Adjusts​Content​Insets:​ Bool

A Boolean that indicates whether the scroll view automatically adjusts its content insets.

var content​Insets:​ Edge​Insets

The distance that the scroll view’s subviews are inset from the enclosing scroll view during tiling.

var scroller​Insets:​ Edge​Insets

The distance the scrollers are inset from the edge of the scroll view.

Scroller Style

var scroller​Knob​Style:​ NSScroller​Knob​Style

The knob style of scroll views that use the overlay scroller style.

var scroller​Style:​ NSScroller​Style

The scroller style used by the scroll view.

Setting Scrolling Behavior

var line​Scroll:​ CGFloat

The scroll view’s line by line scroll amount.

var horizontal​Line​Scroll:​ CGFloat

The scroll view’s horizontal line by line scroll amount.

var vertical​Line​Scroll:​ CGFloat

The scroll view’s vertical line by line scroll amount.

var page​Scroll:​ CGFloat

The amount of the document view kept visible when scrolling page by page.

var horizontal​Page​Scroll:​ CGFloat

The amount of the document view kept visible when scrolling horizontally page by page.

var vertical​Page​Scroll:​ CGFloat

The amount of the document view kept visible when scrolling vertically page by page.

var scrolls​Dynamically:​ Bool

A Boolean that indicates whether the scroll view redraws its document view while scrolling continuously.

func scroll​Wheel(with:​ NSEvent)

Scrolls the receiver up or down, in response to the user moving the mouse’s scroll wheel specified by the​Event.

Updating Display After Scrolling

func reflect​Scrolled​Clip​View(NSClip​View)

Adjusts the receiver’s scrollers to reflect the size and positioning of its content view.

Arranging Components

func tile()

Lays out the components of the receiver: the content view, the scrollers, and the ruler views.

Find Bar Positioning

Specifying a Document’s Predominant Scrolling Behavior

var uses​Predominant​Axis​Scrolling:​ Bool

A Boolean that indicates whether the scroll view uses a predominant scrolling axis for content.

Specifying the Scroll View Elasticity

var horizontal​Scroll​Elasticity:​ NSScroll​Elasticity

The scroll view’s horizontal scrolling elasticity mode.

var vertical​Scroll​Elasticity:​ NSScroll​Elasticity

The scroll view’s vertical scrolling elasticity mode.

Flashing Overlay Scroll Bars

func flash​Scrollers()

Flash the overlay scroll bars.

Zooming the Scroll View

var allows​Magnification:​ Bool

Allows the user to magnify the scroll view.

var magnification:​ CGFloat

The amount by which the content is currently scaled.

func magnify(to​Fit:​ NSRect)

Magnifies the content view proportionally such that the given rectangle fits centered in the scroll view.

var max​Magnification:​ CGFloat

The maximum value to which the content can be magnified.

var min​Magnification:​ CGFloat

The minimum value to which the content can be magnified.

func set​Magnification(CGFloat, centered​At:​ NSPoint)

Magnify the content by the given amount and center the result on the given point.

Constants

NSScroll​Elasticity

These constants determine the elasticity behavior for an axis of the scrollview.

NSScroll​View​Find​Bar​Position

These constants define the position of the find bar in relation to the scroll view.

Notifications

static let NSScroll​View​Will​Start​Live​Scroll:​ NSNotification.Name

Posted on the main thread at the beginning of user-initiated live scroll tracking (gesture scroll or scroller tracking, for example, thumb dragging).

static let NSScroll​View​Did​Live​Scroll:​ NSNotification.Name

Posted on the main thread after changing the clipview bounds origin due to a user-initiated event.

static let NSScroll​View​Did​End​Live​Scroll:​ NSNotification.Name

Posted on the main thread at the end of live scroll tracking.