func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let newText = (textView.text as NSString).replacingCharacters(in: range, with: text)
let numberOfChars = newText.count
if(numberOfChars > 200){
let leng = 200 - textView.text.characters.count
textView.text = (textView.text as NSString).replacingCharacters(in: range, with: text.substring(r:0..<leng))
}
}
'iOS' 카테고리의 다른 글
iOS13 Beta 4 (0) | 2019.07.19 |
---|---|
[ETC]유니코드 한글 변환 (0) | 2019.03.13 |
[swift] 정규식 (0) | 2017.12.01 |
[swift] Util(UIImageView) (0) | 2017.12.01 |
[swift] Util(UIImage) (0) | 2017.12.01 |