轻松禁用UITextField的方法? [英] Easy way to disable a UITextField?
本文介绍了轻松禁用UITextField的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法可以在代码中禁用 UITextField
?
Is there an easy way to disable a UITextField
in code?
我的应用有12 UITextField
默认情况下全部打开,但是当我的段控件中检测到更改时,我想禁用部分 UITextField
取决于用户选择的细分。
My app has 12 UITextField
that are all turned on by default, but when a change is detected in my Segment Control I want to disable some of the UITextField
depending on what Segment the user picks.
只需要知道如何禁用它或使其不可编辑?
Just need to know how to disable it or make it non-editable?
谢谢
推荐答案
在Objective-C中:
In Objective-C:
textField.enabled = NO;
在Swift中:
textField.isEnabled = false
这篇关于轻松禁用UITextField的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文