Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(Objective-c) Text View "Clear When editing starts"

Is it possible to add Clear when editing starts to a text view? This option is available for the text field but I couldn't find anything for the text view.

Thanks!

like image 863
inFever Avatar asked Nov 07 '10 16:11

inFever


1 Answers

Implement the UITextViewDelegate method called textViewDidBeginEditing:, and inside of it, set the text property to an empty NSString object:

- (void) textViewDidBeginEditing:(UITextView *) textView {
  [textView setText:@""];
  //other awesome stuff here...
}
like image 168
Jacob Relkin Avatar answered Oct 05 '22 13:10

Jacob Relkin