UITextField UITextView

UITextField光标

2021-09-09  本文已影响0人  演繹陌路人生
  1. 开始编辑时将光标移动到最后
func textFieldDidBeginEditing(_ textField: UITextField) {
        textField.tintColor = .clear
        CATransaction.begin()
        CATransaction.setCompletionBlock {
            textField.selectedTextRange = textField.textRange(from: textField.endOfDocument, to: textField.endOfDocument)
            textField.tintColor = nil
        }
        CATransaction.commit()
    }
上一篇下一篇

猜你喜欢

热点阅读