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?...


Solution 1:

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.

Solution 2:

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)