swift textField

2022-03-31  本文已影响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
}
}

上一篇 下一篇

猜你喜欢

热点阅读