What does the force parameter do in UIView.endEditing?

In what situation self.view.endEditing(true) and self.view.endEditing(false) produce different results?


Documents for func endEditing(force: Bool) -> Bool specify the following for the force parameter:

Indicate true to force the first responder to resign, regardless of whether he wants to do so.

+5
source share
1 answer

As a comment mentioned, if canResignFirstResponder returns false, self.view.endEditing(true) will cause the control to lose focus, but self.view.endEditing(false) will not.

+3
source

Source: https://habr.com/ru/post/1243648/


All Articles