views:

2825

answers:

1

HI people :)

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

My app has 12 UITextFields that are all turned on by default, but when a change is detected in my Segment Control I want to disable some of the UITextFields depending on what Segment the user picks.

Just need to know how to disable it or make it non-editable?

Thanks

+10  A: 

Try this:

textField.enabled = NO;
Joel Levin
lol, was sure I tried this all-ready, but I must have made a typo or something because it works.. your a lifesaver... Thanks :)
CC
If you're ever trying to find out *if* its enabled, keep in mind the getter is textField.isEnabled, not textField.enabled.
Mk12