below you\'ll find my .h & .m files for my primary viewcontroller.
I have 3 questions.
1.) Because I have multiple uitextfields, do I have to set each with
This answer works for iOS 7 and arc,
dismiss keyboard when user touches return: in ViewController add the following action
-(IBAction)textFieldReturn:(id)sender { [sender resignFirstResponder]; }
next, in main.storyboard select the textField and from the connections inspector control + drag "Did End On Exit" event to the view controller.
dismiss keyboard when user touches background: implement the following method in the ViewController
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; if ([YOUR_TEXT_FIELD isFirstResponder] && [touch view] != YOUR_TEXT_FIELD) { [YOUR_TEXT_FIELD resignFirstResponder]; } [super touchesBegan:touches withEvent:event]; }