Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide cursor on UITextView - Swift

I have an app that have user feedback feature. I have done the view as shown in the image. Feedback view that I made

  • Message area is using UITextView.

What I want to do now is when user finished editing the textView, then they click other places such as the star rating or any area besides textview, it will hide the cursor on the textview but it will keep the written text at the same time.

Can anyone help me with this? Thank you.

like image 483
Syafiq Mastor Avatar asked Nov 28 '22 01:11

Syafiq Mastor


2 Answers

You can make the tint color transparent to hide the cursor.

textView.tintColor = UIColor.clearColor()

In Swift 3:

textView.tintColor = UIColor.clear
like image 123
Adam Avatar answered Dec 18 '22 12:12

Adam


Update for Swift 3.x:

textField.tintColor = .clear
like image 38
David Sanford Avatar answered Dec 18 '22 13:12

David Sanford