Instance Method

lockFocusIfCanDraw()

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

Declaration

func lockFocusIfCanDraw() -> Bool

Discussion

Your thread will not be preempted by other threads between the canDraw method and the lock. This method fails to lock focus and returns false, when the view is hidden and the current context is drawing to the screen (as opposed to a printing context).

See Also

Focusing

func lockFocus()

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

Deprecated
func lockFocusIfCanDraw(in: NSGraphicsContext) -> Bool

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

Deprecated
func unlockFocus()

Unlocks focus from the current view.

Deprecated
class var focusView: NSView?

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