I have a UITextView and I can't seen to get the NSNotification of UITextViewTextDidBeginEditingNotification to work. I am implementing it almost the exact same as I implement the similar NSNotification for a UITextField. Here is my code to set up both notifications:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldDidChange:) name:UITextFieldTextDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textViewDidBeginEditing:) name:UITextViewTextDidBeginEditingNotification object:nil];
And I have implemented the method for the latter like so:
-(void)textViewDidBeginEditing:(UITextView *)textView {
Which I believe is correct, but when I click inside a UITextView, it crashes with the message
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteNotification text]: unrecognized selector sent to instance 0x7965e4d0'
If I change the end of my addObserver line so it says
...object:self];
then it doesn't crash but nothing happens (because I guess 'self' in this case is the View Controller
and if I change it to the name of the actual UITextView property like this it crashes
object:self.nameField];