3

I have an app with a UITextField. When the containing view appears, I want a keyboard to slide up and begin editing this text field. Not sure how I would go about doing this?

I've tried:

func viewDidLoad {
textField.editing == true
textField.selected == true
arogachev
  • 33,150
  • 7
  • 114
  • 117
YichenBman
  • 5,011
  • 8
  • 46
  • 65

1 Answers1

10

In viewWillAppear add a call to becomeFirstResponder, something like this:

[textField becomeFirstResponder];

or in Swift:

textField.becomeFirstResponder()
rmaddy
  • 314,917
  • 42
  • 532
  • 579
joe77
  • 211
  • 2
  • 5