Instance Method


Unlocks focus from the current view.


func unlockFocus()


Call this method after a previous call to the lockFocus(), lockFocusIfCanDraw(), or lockFocusIfCanDraw(in:) method of this view object. Doing so releases focus from the current view and returns it back to the previously focused view, if any. This method raises an NSInvalidArgumentException if the current view does not have the focus.

See Also


func lockFocus()

Locks the focus on the view, so subsequent commands take effect in the view’s window and coordinate system.

func lockFocusIfCanDraw() -> Bool

Locks the focus to the view atomically if the canDraw method returns true and returns the value of canDraw.

func lockFocusIfCanDraw(in: NSGraphicsContext) -> Bool

Locks the focus to the view atomically if drawing can occur in the specified graphics context.

class var focusView: NSView?

Returns the currently focused NSView object, or nil if there is none.