Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable UITextField's edit property? [duplicate]

Tags:

ios

uikit

Possible Duplicate:
Easy way to disable a UITextField?

I have a UITextField. I want to disable its edit property. I just want to display a text in it.

How can i achieve it ?.

like image 315
Arun Avatar asked Dec 02 '11 11:12

Arun


1 Answers

To disable editing in UITextField you need to return NO in delegate method textFieldShouldBeginEditing:

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{     return NO; } 

To disable editing in UITextView set property editable to NO:

[textView setEditable:NO]; 
like image 69
beryllium Avatar answered Oct 05 '22 05:10

beryllium