Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to detect tab button pressed in ipad app from wireless keyboard

HI I want to detect tab button pressed in iPad app from wireless keyboard(external keyboard) So I make next textfield first responder. I am doing the following code, But it not working on tab key. It working fine incase return key.

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    if(textField == textName){      
        if ([string isEqualToString:@"\t"]) {
            [textName resignFirstResponder];
              [textRno becomeFirstResponder];   
        }
    }
    return YES;
}

Is there any other way for it.

like image 741
mandeep-dhiman Avatar asked Jul 18 '11 11:07

mandeep-dhiman


2 Answers

Seems you want to switch to the next input view (e.g. text field) on tab stroke. The system does this automatically!

You can control the "tab-order" using the view tags and the code in this answer: https://stackoverflow.com/a/1351090/550177

Also look at these related questions:

  • How do you set the tab order in iOS?
  • How to navigate through textfields (Next / Done Buttons)
like image 69
Felix Avatar answered Oct 19 '22 23:10

Felix


TextField delegate never get called for a tab button on the keyboard..

like image 29
iOS Monster Avatar answered Oct 19 '22 23:10

iOS Monster