Reputation: 7022
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?
Upvotes: 0
Views: 1968
Reputation: 5326
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.
Upvotes: 2
Reputation: 23872
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.
Upvotes: 2
Reputation: 71854
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:
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.
Upvotes: 0