I have a textfield and when the user clicks on it, they will be presented with the keyboard. there is a GO
button on the keyboard, and i want to write an action
event to it.
1.) How can i write an action
when the user clicks on this button
2.) when the keyboard is open, and when the user clicks on the background i need the keyboard to disappear, how can i do this programatically?
I have no code to demonstrate, i have only added a texfield, so the keyboard would appear by default once clicked
for performing some action on return of textfield/ Go button use following code
-(BOOL)textFieldShouldReturn:(UITextField *)theTextField {
[theTextField resignFirstResponder];
//call Method when the GO button is pressed
return YES;
}
And when user touches on the background and keyboard should return - for that ,write below code
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[textFiedl resignFirstResponder];
}
hope your issues are resolved with this.