cyclingIsBetter
cyclingIsBetter

Reputation: 17591

IOS: UItextfield disabled

When we push on a textfield, a cursor appears in this textfield, but I don't want that this cursor appear. I want to make this textfield disabled, where you can't write inside.

How can I do this?

Upvotes: 7

Views: 17326

Answers (2)

BossBols
BossBols

Reputation: 175

If you're working with storyboards or .nib files and you want it to start out disabled you can also easily uncheck the enabled property in interface builder for some time-saving.

Upvotes: 2

PgmFreek
PgmFreek

Reputation: 6402

Can you set enabled property/userInteractionEnabled of text field to No in ViewDidLoad() using the code

textField.enabled = NO;

or

textField.userInteractionEnabled = NO;

Upvotes: 21

Related Questions