I am developing an application that uses a bluetooth barcode scanner (OPN-2002). To read the value from the scanner I am listening for keyboard events with the following code:
[textField addTarget:self action:@selector(valueFromScanner:) forControlEvents:UIControlEventEditingChanged];
...
- (void)valueFromScanner:(id)sender {
NSLog(@"%@", ((UITextField *)sender).text);
}
With this code the value from the scanner gets printed to the log one character at a time instead of when the whole barcode has been scanned. Does anyone know how to do that?
I can't check for a specific length of the string becuase of the different sizes of the barcodes I need to scan.
I am not sure but I think think the scanner ends the scanned barcode with a newline character or an enter character, how do I test if the string containes a newline or enter character?