Search code examples
iosuibuttonswift3uitextfieldtvos

Bring up textfield when button is tapped


I'm trying to implement a feature where if a user taps on a button, it brings up the textfield for the user to type something in. Once the user is done, I want to navigate the user to another screen with text that he just typed.

How do I implement bringing up the textfield for the user to type in when the button is tapped?


Solution

  • on the button action just add self.yourTextField.becomeFirstResponder ... then controller.text = yourTextField.text ...