- 开始编辑时将光标移动到最后
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()
}
网友评论