在UITextField中禁用闪烁光标? [英] Disable blinking cursor in UITextField?

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

问题描述

我已按照说明这里,并成功设定使用UIDatePicker更新的UITextField。然而,UITextField中的光标闪烁,这对我来说似乎有点尴尬。

I've followed the instructions here and succesfully set up a UITextField that gets updated with a UIDatePicker. However the cursor in the UITextField is blinking, which seems quite a bit awkward to me. Is there any solution to get rid of that cursor?

推荐答案

子类UITextfield和覆盖 - (CGRect)caretRectForPosition:(UITextPosition *)position 方法并返回 CGRectZero

Subclass UITextfield and Override the - (CGRect)caretRectForPosition:(UITextPosition *)position method and return CGRectZero.

- (CGRect)caretRectForPosition:(UITextPosition *)position {
    return CGRectZero;
}

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

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