1

I'm new on Swift and I have a question. Introduction: View1-> a view with a button that when clicked goes to view2 View2-> a view with a text field

When I go to View2,to start writing I have to click in the text field. I want that when I change the view1 to view2, the cursor is already in text field ready to write with the keyboard up. So do you guys no how i can do it? Thanks for the help!

Daniel Da Costa
  • 165
  • 1
  • 10

1 Answers1

1

Try putting in second view controller under viewdidload function the below code

textfield.textAlignment = .left

for the keyboard

textfield.becomeFirstResponder()

Try looking at this answer

or you can follow this tutorial

Community
  • 1
  • 1
chirag90
  • 2,061
  • 1
  • 19
  • 34