Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS Dismiss/Show keyboard without Resigning First Responder

Tags:

ios

keyboard

My application is used with a barcode scanner connected via Bluetooth. When the scanner is connected you can double tap a button on the scanner to dismiss/show the on screen keyboard. 90% of the time the user will want the keyboard to be hidden as they will be scanning a barcode to input data. There are a few exceptions that I know of ahead of time that the keyboard will need to be enabled, I would like to save them the effort of pressing the scanner button to bring up the keyboard and instead force the keyboard to show up.

The scanner does not use resignfirstresponder to dismiss the keyboard, this is evident because the cursor is still visible and scanning a barcode will input data into the current text field.

Does anyone know how to dismiss/show the on screen keyboard without using resignfirstresponder?

For reference I am using this scanner http://ww1.socketmobile.com/products/bluetooth-scanners/how-to-buy/details.aspx?sku=CX2864-1336

like image 223
James Crowther Avatar asked Sep 23 '13 15:09

James Crowther


1 Answers

To end editing completely in the view you can use the following

[self.view endEditing:YES];

This will remove the keyboard for you in the view.

like image 109
darren102 Avatar answered Oct 03 '22 23:10

darren102