在iOS中停止UITextField光标闪烁 [英] Stop UITextField cursor from blinking in iOS

查看:1438
本文介绍了在iOS中停止UITextField光标闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法阻止光标在UITextField中闪烁?我知道你可以使用 [UITextField resignFirstResponder] [UITextField setEnabled:NO]

为了说明,我不打算在用户编辑文本字段时隐藏光标,但是我想在用户点击Done并显示进度指示器后隐藏它在文本字段上方。

解决方案

您可以创建一个不可见的文本字段,它是第一响应者。完成后,您可以将第一个响应者设置回原始文本字段,并删除不可见文本字段。


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.

解决方案

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.

这篇关于在iOS中停止UITextField光标闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆