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

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift