在UITextField中禁用放大镜 [英] Disable Magnifying Glass in UITextField

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

问题描述

有没有办法防止用户在UITextField中移动光标?

解决方案

没有办法阻止他们移动光标。但是,您可以阻止他们编辑文本,除非最后执行



- textField:shouldChangeCharactersInRange:replacementString:



编辑:您也可以设置 userInteractionEnabled NO ,以便用户无法点击该字段。手动调用 becomeFirstResponder ,以便该字段获得焦点,因为用户无法点按焦点。


Is there a way to prevent the user from moving the cursor in a UITextField? I'd like it to stay at the end of the string.

解决方案

There's no way to prevent them from moving the cursor. You can, however, prevent them from editing the text except at the end by implementing the

– textField:shouldChangeCharactersInRange:replacementString:

method in your text field's delegate.

Edit: you can also set userInteractionEnabled to NO so that the user can't tap the field. Call becomeFirstResponder manually so that the field gets focus since the user can't tap to focus.

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

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