Michael Paniccia Michael Paniccia - 11 months ago 52
iOS Question

how to block user from changing text field

I have two text fields that I don't want the user to change. Is there a way to do this in Xcode 6? I have already entered text in the text field but when I simulate the app the user is still able to modify it.

Answer Source

Return 'NO' for the delegate method:

`- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField`.

or disable the textField, that may alter the appearance.

textField.enabled = NO

or use a UILabel.