Stop UITextField cursor from blinking in iOS

荒凉一梦 提交于 2020-01-05 08:08:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!