UITextView finished editing

I would like NSLog something when my UITextView is executed.

I tried

- (BOOL)textViewShouldEndEditing:(UITextView *)textView

and

- (void)textViewDidEndEditing:(UITextView *)textView

did not work.

fix:

myTextView.delegate = self;

+4
source share
2 answers

Do you ask a delegate for your text?

fix:

set the delegate in the .h file as follows:

 #import <UIKit/UIKit.h> @interface TextViewController : UIViewController <UITextViewDelegate> { UITextView *textView; } @property (nonatomic, retain) UITextView *textView; @end 
+10
source

If you are using UITextField, be sure to use UITextFieldDelegate, not UITextViewDelegate. And this method instead fixed my problems.

 - (void)textFieldDidEndEditing:(UITextField *)textField 
+2
source

Source: https://habr.com/ru/post/1440173/


All Articles