Michael Paniccia Michael Paniccia - 3 months ago 12
iOS Question

how to block user from changing text field swift xcode 6

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

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.