问题
Is there a way to stop the cursor from blinking in a UITextField? I know you can use [UITextField resignFirstResponder]
and [UITextField setEnabled:NO]
, but I'd like to keep the keyboard visible on the screen.
Thanks!
Update
To clarify, I have no intention of hiding the cursor while the user is editing the text field, but I want to hide it after the user has hit Done and a progress indicator has appeared above the text field. A blinking cursor seems weird in a view that can't be manipulated with.
回答1:
You can create an invisible text field and make it the first responder. Once you're done, you can set the first responder back to the original text field and remove the invisible text field.
来源:https://stackoverflow.com/questions/6374595/stop-uitextfield-cursor-from-blinking-in-ios