iOS textView Issues swift

Problem:

When try to use shouldChangeTextIn textView delegate method for text entering character count you will use the below code.

textView.text = textView.text+string

then if you enter the characters contineously it works well.If you remove front string or interstring then last typed charater is to be placed in last only.So use the below code.


            textView.text = (textView.text as! NSString).replacingCharacters(in: range, with: text)

Comments

Popular posts from this blog

How to blink a button iOS swift?

iOS flutter while run to iPhone it had the error - Cannot find type 'PhoneNumberKit' in scope