Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITextViewDelegate methods not being called (UITextView within UITableViewCell)

I must be doing something fundamentally wrong, my implementation methods for the UITextViewDelegate aren't firing. I have a UITextView that is a subview of a UITableCellView and the delegates aren't being called.

- (void)textViewDidBeginEditing:(UITextView *)textView {

    NSLog(@"textViewDidBeginEditing");
    // never called...
}

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

    NSLog(@"shouldChangeTextInRange");  
    // never called... 
}

Suggestions? I don't know whether it matters, but the protocol is explicitly named in my @interface declaration.

@interface DetailViewController () <UITextViewDelgate, ..., ....>

Thanks!

like image 201
ToddB Avatar asked Sep 27 '12 17:09

ToddB


1 Answers

You should add the textViewObj.delegate = self or give delegate connection for that text view property in xib file, then it should work and fire all delegate methods of UITextView.

like image 54
Ganesh G Avatar answered Nov 15 '22 21:11

Ganesh G