Reputation: 5259
Here is my code:
In .h file
@interface VTViewController : UIViewController <UITextFieldDelegate>
In .m file
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.postText.delegate = self;
}
#pragma mark - textField delegate
- (void)textViewDidBeginEditing:(UITextView *)textView {
NSLog(@"textViewDidBeginEditing:");
}
- (void)textViewDidEndEditing:(UITextView *)textView{
NSLog(@"textViewDidEndEditing:");
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return NO;
}
The last one works, the first two do not since I do not see the NSLog being printed. I also tried connected the textfield in the IB.
Upvotes: 0
Views: 826
Reputation: 119021
You are mixing your methods up - some are text view methods and some are text field methods. Check the names from the appropriate delegate protocols and replace as required.
Upvotes: 4