I have taken a textField in a tableView. I want the user cant be able to edit the content of textField but can copy the contents.
I used the method textField.editing = false; but it also disable the copying feature.
I have taken a textField in a tableView. I want the user cant be able to edit the content of textField but can copy the contents.
I used the method textField.editing = false; but it also disable the copying feature.
Use textField:shouldChangeCharactersInRange:replacementString
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
return NO;
}
Don't forget to set your textfield's delegate.
To disable editing in UITextField you need to return NO in delegate method
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
return NO;
}
or you can do this also To disable editing in UITextView set property editable to NO:
[textView setEditable:NO];