美文网首页
swift textField

swift textField

作者: 奔跑吧小蚂蚁 | 来源:发表于2022-03-31 18:40 被阅读0次

public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
guard let textString = textField.text else {
return false
}
let textLeng: Int = textString.count
let replace: Int = string.count - range.length
return textLeng + replace <= maxTextCount
}

@objc func textFiledChanged(sender: UITextField) {
if let textString = sender.text {
describeLab.isHidden = textString.count > 0
}
}

相关文章

网友评论

      本文标题:swift textField

      本文链接:https://www.haomeiwen.com/subject/fgmnjrtx.html