Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextView did end editing

I would like to NSLog something when my UITextView is done editing.

I've tried

- (BOOL)textViewShouldEndEditing:(UITextView *)textView

and

- (void)textViewDidEndEditing:(UITextView *)textView

neither worked.

fix:

myTextView.delegate = self;

like image 750
atomikpanda Avatar asked Dec 15 '22 18:12

atomikpanda


2 Answers

do you set the delegate of your textview?

fix:

set delegate in .h file like this:

#import <UIKit/UIKit.h>  

@interface TextViewController : UIViewController <UITextViewDelegate>  
{  
          UITextView *textView;  
}  
@property (nonatomic, retain) UITextView *textView;  
@end 
like image 155
LianYong Lee Avatar answered Dec 25 '22 11:12

LianYong Lee


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

- (void)textFieldDidEndEditing:(UITextField *)textField
like image 41
Zeezer Avatar answered Dec 25 '22 10:12

Zeezer