Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
Images
SetUITextFieldFocus
README.md
SetUITextFieldFocus.sln

README.md

id title brief sdk
DF80ADC5-9941-427E-ABAE-0FCF7BD0B2A9
Setting the Focus to a UITextField
Code can manually change the focus of a view to bring up the keyboard for entry in a UITextField without tapping it.

Recipe

Focus Screen

To have our UITextField, in this case named FocusTextField, selected as soon as we open the view, we can place the following line of code in the ViewDidLoad() method:

FocusTextField.BecomeFirstResponder ();

Additional Information

We can call BecomeFirstResponder on a UITextField at any point to switch focus - not just inside ViewDidLoad.