In my iOS app, I have a view with a textField and a textView, both which are editable:
I want to scroll the view only when the user clicks on the textView (at the bottom) and not the textField. I set up a Notification for when the keyboard appears:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
But this notification gets triggered whenever the keyboard appears, regardless of what field was triggered. How do I only trigger the notification for the textField? I tried the following:
[[NSNotificationCenter defaultCenter] addObserver:self.stepDescriptionField
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
But then when I click on the textField, I get the error:
[UITextView keyboardWasShown:]: unrecognized selector sent to instance 0x13cd30950
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextView keyboardWasShown:]: unrecognized selector sent to instance 0x13cd30950'