Hello,
so I was going through the tutorial part 14 where the functionality of hiding the keyboard is described.

In the tutorial it is stated to hide the keyboard if the button is pressed using


self.usernameTxtField.resignFirstResponder()
self.passwordTxtField.resignFirstResponder()


My question is now why exactly do I use

resignFirstResponder() 

in the button event but

self.view.endEditing(true)

in the touchesBegan event?

I've tried to use

self.view.endEditing(true)

in the button event and it worked too.

Can someone explain this to me?