Display keyboard without animation

后端 未结 7 1515
感情败类
感情败类 2020-11-29 03:12

Looked intoUIKeyboardAnimationDurationUserInfoKey but I just can\'t find anywhere how to set it to a custom value.

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-29 03:48

    I've found the best solution is using UIView.setAnimationsEnabled(_ enabled: Bool).

    Swift 3

    UIView.setAnimationsEnabled(false)
    textField.becomeFirstResponder()
    // or textField.resignFirstResponder() if you want to dismiss the keyboard
    UIView.setAnimationsEnabled(true)
    

提交回复
热议问题