Handle return key of bluetooth keyboard for number pad

352 views Asked by At

In the app I am performing some action on custom done button that is added on the Number pad, as number pad does not have return key. Now, the problem is when hardware keyboard is attached I am not able to handle the return key press on hardware keyboard in case of Number pad. Is there any way to receive return press event of external bluetooth keyboard for number pad textfield?

2

There are 2 answers

0
jjv360 On

If you are using a UITextField for input, you can implement it's delegate method, which should work for hardware and software keyboard return key...

-(BOOL) textFieldShouldReturn:(UITextField*)textField {

    // Return was pressed, do something here

}
0
dhiren bharadava On

you can use this code.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
    [textField resignFirstResponder];
}