Sets the selection to the characters in an array of ranges in response to user action.
SDK
- macOS 10.4+
Framework
- App
Kit
Declaration
func setSelectedRanges(_ ranges: [NSValue], affinity: NSSelection Affinity, stillSelecting stillSelectingFlag: Bool)
Parameters
ranges
A non-nil, non-empty array of objects responding to the NSValue
range
method. The ranges in theValue ranges
array must begin and end on glyph boundaries and not split base glyphs and their nonspacing marks.affinity
The selection affinity for the selection. See
selection
for more information about how affinities work.Affinity stillSelectingFlag
true
to behave appropriately for a continuing selection where the user is still dragging the mouse,false
otherwise. Iftrue
, the receiver doesn’t send notifications or remove the marking from its marked text. Iffalse
, the receiver posts andid
to the default notification center and removes the marking from marked text if the new selection is greater than the marked region.Change Selection Notification
Discussion
This method also resets the selection granularity to NSSelect
.