My problem is that none of the delegate methods of the UITextView are called.
My code, I did not include the entire class, but only the relevant parts. I do not use XIB, all this is added programmatically. None of my delegate methods are called.
.h
@interface ChatAppViewController : UIViewController <UITableViewDelegate,
UITableViewDataSource, UITextViewDelegate>
{
UITextView * messageTextField;
}
.m
- (void)viewDidLoad
{
messageTextField = [[UITextField alloc] initWithFrame:CGRectMake(5, 408, 310, 70)];
messageTextField.textColor = [UIColor blackColor];
messageTextField.font = [UIFont systemFontOfSize:17.0];
[messageTextField setPlaceholder:@"Post a message" ];
messageTextField.backgroundColor = [UIColor whiteColor];
messageTextField.autocorrectionType = UITextAutocorrectionTypeNo;
messageTextField.keyboardType = UIKeyboardTypeDefault;
messageTextField.returnKeyType = UIReturnKeyDone;
messageTextField.delegate = self;
messageTextField.hidden = NO;
[self.view addSubview:messageTextField];
}
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView {
NSLog(@"textViewShouldBeginEditing");
return YES;
}
- (void)textViewDidBeginEditing:(UITextView *)textView {
NSLog(@"textViewDidBeginEditing");
}
- (void)textViewDidChange:(UITextView *)textView {
NSLog(@"textViewDidChange");
}
- (void)textViewDidChangeSelection:(UITextView *)textView {
NSLog(@"textViewDidChangeSelection");
}
- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
NSLog(@"textViewShouldEndEditing");
return YES;
}
- (void)textViewDidEndEditing:(UITextView *)textView {
NSLog(@"textViewDidEndEditing");
}
Thanks a lot, code
user440096
source
share