UIResponder.BecomeFirstResponder Method

Definition

Request the object to become the first responder.

[Foundation.Export("becomeFirstResponder")]
public virtual bool BecomeFirstResponder ();
abstract member BecomeFirstResponder : unit -> bool
override this.BecomeFirstResponder : unit -> bool

Returns

Returns true if the object accepts becoming the first responder, or false if it does not. The default is to accept.

Attributes

Remarks

You can overwrite this method to detect when your UIResponder object becomes the first responder and to either accept or reject the request.

Typically this method is invoked by application code to request that a specific object become the first responder. Typically to give the focus to a UIView, for example, to focus a UITextField or a UITextView.

It is possible for this call to fail if the current first responder refuses to give up control. This condition can be detected by probing the CanResignFirstResponder.

This method is only valid if invoked in a UIResponder that is part of the currently active responder chain. Sending this to a UIView that has not been added to a responder chain does nothing.

Applies to