Michael Paniccia Michael Paniccia - 1 year ago 94
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 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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download