Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cursor not showing up in UITextView

Can anyone think of a reason that the blinking cursor would not show up in a UITextView? I have a custom control that is just a subclass of UIView and it has a UITextView in it, but the cursor doesn't appear when it gets focus. The keyboard appears, and the text appears as you type, but there is no cursor, and I can't figure out why.

Any thoughts?...

like image 626
SeanT Avatar asked Jan 06 '14 21:01

SeanT


4 Answers

You may have changed the tint color in your custom UITextView. If the tint color is the same as the background color (normally white), then it will appear invisible.

like image 54
lehn0058 Avatar answered Oct 23 '22 01:10

lehn0058


You might be setting improperly a contentSize and/or frame for the component so it is too small to be visible or the control is out of the screen. Please go in Simulator to Debug->Color Blended Layers to see whether those values are set correctly.

EDIT:

With new Xcodes (probably introduced in Xcode 6) you can debug this kind of issues by clicking "Debug View Hierarchy" (it is one of the icons on the bottom bar)

like image 30
Julian Avatar answered Oct 23 '22 01:10

Julian


The textfield is showing the cursor but you are not able to see the color, just because the tint color of your text field is set to default most probably as in my case it was. Just select you textField in storyboard and Select the link color of your wish. Refer to the image attached.

enter image description here

like image 4
Kunal Gupta Avatar answered Oct 23 '22 03:10

Kunal Gupta


I changed the tint color of all of my UITextViews and the cursor started showing on the next build.

like image 3
Andy Bernard Avatar answered Oct 23 '22 02:10

Andy Bernard