In running my program, a basic chat app which i’m writing to learn ios, i noticed different results with:
[self._inputBox resignFirstResponder];
vs
[sender resignFirstResponder];
i have this ibaction:
- (IBAction)_sendText:(id)sender
which is called on hitting the send button. its also called on enter as that ibaction calls the same ibaction as the send button.
Now on the iphone which i just supported tonight ( it’s a one view now i have both a view on my ipad storyboard and my ipod and wired the ipad actions to the ipod storyboard tonight) for clicking the send button which is wired to this ibaction, self.inputBox calling resignFirstResponder works but sender resignFirstResponder did not work. I have a friend who is testing and he was the one who found it didn’t work on his ipod. I have only run it in the simulator and both worked there.
Mike
If a “Send” button is connected to your
_sendText:action and you click that button, then the button is the sender and not your text input field, therefore [sender resignFirstResponder]will not have the desired effect.