Easy way to disable a UITextField?

前端 未结 5 1377
一向
一向 2020-11-29 08:01

Is there an easy way to disable a UITextField in code?

My app has 12 UITextField that are all turned on by default, but when a change is de

5条回答
  •  萌比男神i
    2020-11-29 08:32

    In Objective-C:

    textField.enabled = NO;
    

    In Swift:

    textField.isEnabled = false
    

    Reference: UIControl.isEnabled

提交回复
热议问题