0

I've build a custom keyboard, but I don't want that the people to go to Settings > General. Select Keyboard and then click on Add Keyboard, I would like the people just open the app and when a certain text field get focused my custom keyboard appear.

How can I achieve this?

Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80
Jonathan Solorzano
  • 6,812
  • 20
  • 70
  • 131

3 Answers3

2

You can not do it. User must have to select keyboard from the settings. You can not force to use your keyboard by the user.

For more check the documents provided by apple for the custom keyboard : https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html

There are some pros and cons also there.

Shabbir Dhangot
  • 8,954
  • 10
  • 58
  • 80
Ashish Kakkad
  • 23,586
  • 12
  • 103
  • 136
2

You can not force the user to choose your keyboard. If it really matter, you may add a custom view as input for your textfield, and implement your keyboard in that view.

Good luck.

Yedidya Reiss
  • 5,316
  • 2
  • 17
  • 19
  • Could you please give an example?, do you mean that no keyboard will be displayed in the focus of the textfield, it will be a static view? – Jonathan Solorzano Jun 17 '15 at 16:43
  • Yes, as you can switch the input view to a picker view, you may also assign any other view. Just assign to your UITextfield the view that you made (i.e. _txtField.inputView = self.customInputView). – Yedidya Reiss Jun 18 '15 at 05:39
  • I used this as an example to build my own keyboard as an input view : https://github.com/suragch/MongolAppDevelopment-iOS hope it helps – Steven B. Dec 16 '16 at 08:16
0

Simply you can not force user to use your custom keyboard. If user select your custom keyboard form setting then they can use your custom keyboard but without selecting your custom keyboard from setting they can not use your custom keyboard.

If your textField need some special type of input then you can set keyboard for it by selecting your textField go to Attribute inspector at keyBoard type you can find some default Keyboard which is available by apple as shown in below Image:

enter image description here

You can use any of this keyboard from here.

And If you want to set it Programmatically you can do it this way:

yourTextField.keyboardType = .NumberPad

Here is a keyboardType property for a UITextField:

enum UIKeyboardType : Int {

    case Default // Default type for the current input method.
    case ASCIICapable // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active
    case NumbersAndPunctuation // Numbers and assorted punctuation.
    case URL // A type optimized for URL entry (shows . / .com prominently).
    case NumberPad // A number pad (0-9). Suitable for PIN entry.
    case PhonePad // A phone pad (1-9, *, 0, #, with letters under the numbers).
    case NamePhonePad // A type optimized for entering a person's name or phone number.
    case EmailAddress // A type optimized for multiple email address entry (shows space @ . prominently).
    @availability(iOS, introduced=4.1)
    case DecimalPad // A number pad with a decimal point.
    @availability(iOS, introduced=5.0)
    case Twitter // A type optimized for twitter text entry (easy access to @ #)
    @availability(iOS, introduced=7.0)
    case WebSearch // A default keyboard type with URL-oriented addition (shows space . prominently).
}

Hope it will help you.

Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165
  • Hmm, the thing is that i just need these characters [ digits(Main characters), letters from 'A' to 'F' and these characters: ' / ', ' . ', ' : ', ' :: ' ] – Jonathan Solorzano Jun 17 '15 at 16:44