I have a few text inputs and I can hide the keyboard whenever I touch the background, but only when I have been entering into the first text box name textField1. now this code should be simple but I just can't seem to get it.
-(IBAction)backgroundTouched:(id)sender {
[textField1 resignFirstResponder];
[buildLength resignFirstResponder];
[buildWidth resignFirstResponder];
[ridgeWidth resignFirstResponder];
[rafterWidth resignFirstResponder];
[hipWidth resignFirstResponder];
[eaveOverhang resignFirstResponder];
[spacing resignFirstResponder];
}
backgroundTouched:
action? Is it the view? Some object you put behind everything? The way I got a keyboard to hide on iOS is to override the ViewController'stouchesEnded:withEvent:
. It gets called when no other objects are able to handle a touch event. In there is where I resign the first responder, though you need to checkisFirstResponder
because if you don't consume the touch you are suppose to call super. – Intercellular