始终显示光标 UITextField [英] Always Display Cursor UITextField

查看:39
本文介绍了始终显示光标 UITextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 UITextField,无论键盘是否显示,它都会始终显示闪烁的光标.

I am trying to create a UITextField that will always display the blinking cursor whether the keyboard is displaying or not.

有什么办法可以达到这个效果吗?

Is there any way I can achieve this effect?

推荐答案

@andreamazz 在 Swift 中回答.

@andreamazz answer in Swift.

UITextField 显示光标,即使 userInteractionEnabled 设置为否

UIView.animateWithDuration(1, delay: 0, options: .Repeat, animations: {() -> Void in
cursorView.alpha = 0 }, completion: {(animated: Bool) -> Void in
cursorView.alpha = 1
})

这篇关于始终显示光标 UITextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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