How to access keyboard shortcuts programmatically - ios

In "Settings" -> "General" -> "Keyboard" -> "Shortcuts",we are able to query,add and delete our shortcuts, so when we are typing a shortcut,the full phrase will be showing in the keyboard. So I am wondering if we could access the keyboard shortcuts in code.(for example,I want to add some useful phrases in my app.)
Thanks in advance.

You will not be able to modify the system shortcuts or access them other than the system default (i.e. when the user is typing in a text field or similar).
However, you can check what the user types in a text field within your application using the corresponding delegate methods (e.g. in UITextFieldDelegate). When you detect a shortcut you would like to replace, you get the text field's text and replace the shortcut with the full text.
For anything more specific, you will have to try something yourself and ask more specific questions.

Related

Make bullet/num/check lists in UITextView

I am working on text editor app and using UITextView for this. Does anybody know how to make ability to do bullet/num/check lists in it? Any examples/tutorials?
Note: I need to do this as a part of text editor, so user can select some area, tap on according button and enable/disable lists formatting.
Based on my research for similar behavior (e.g. Bullet list and Numbered list in UITextView ), I would expect that there is no easy way to do it. I expect that you will have to use textView(_:shouldChangeTextIn:replacementText:) to hack currently added text to manually add bullets/numbers - e.g., if the user set that she currently wants to use unordered list, you will have to detect a new line added in shouldChangeTextIn and manually add there the bullet and indentation.
Another approach which you might consider (its applicability depends on your requirements) is to customize existing open source rich text editor. In my case I was able to get close enough to what I needed using RichEditorView, which uses HTML+CSS as an underlying technology (so to be able to do customizations, you need to know a bit about JavaScript, CSS and HTML).

resignFirstResponder() in Third-Party Keyboards

I have a third party keyboard that currently contains a UISearchBar(that is first responder on start) and the user is able to search for content (i.e. gifs) to be able to copy, paste, send to friends, etc.
In theory, after entering text in the bar and pressing search, the user should be able to enter text in the application's actual UITextView (i.e. the message field in the messages app) but for some reason this doesn't work and although typing works, nothing actually appears.
I have tried searchBar.resignFirstResponder(), self.becomeFirstResponder() and many combinations of .endEditing(true) to no avail.
I know it is possible to do this as apps like Giffy do it but I can't figure it out for the life of me.
Any help would be greatly appreciated.
Keyboard extensions with built-in search bars usually implement their search bar as a UILabel, adding custom text handling behavior that modifies the text property of the label based on user input.

Remove letter upper form keyboard

Is it possible to remove letter upper from keyboard ?
Not if its the standard UIKeyboard. You can roll your own keyboard that does not support uppercase. Alternatively, for an easier solution you can make all text lowercase when entered via a bit of code.
You can create your Custom Keyboard with iOS8 App Extension. Try this tutorial :
http://www.appcoda.com/custom-keyboard-tutorial/
Also check at developer.apple.com :
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
A custom keyboard replaces the system keyboard for users who want
capabilities such as a novel text input method or the ability to enter
text in a language not otherwise supported in iOS. The essential
function of a custom keyboard is simple: Respond to taps, gestures, or
other input events and provide text, in the form of an unattributed
NSString object, at the text insertion point of the current text input
object.

Show keyboard according to font selection ios

I want to create a Alphabet (Character) tracing and learning app.Which will be multilingual app.The font for different language will be attached in app resource folder. First user select language and fond. According to language selection the keyboard will be shown.Then user enter a character and trace. Is it possible to show keyboard according to language selection.Or I have to create custom keyboard.Please suggest me.
You have no control over which keyboard gets shown, unless you create a custom one, unfortunately. If you had control, you might request to show a keyboard that the user has not enabled in their settings and this would cause a problem. The only keyboards you can request to open are the ones listed in UIKeyboardType

Custom keyboard in iphone

Does any one know how to Create custom keyboard in iphone? Pls give me any samples for custom keyboard
Hi you need to try following link. They have explained very well and step by step that how to create Custom Keyboard. http://www.appdesignvault.com/ios-8-custom-keyboard-extension/
But while creating Custom Keyboard there are some limitations you must know:
A Custom Keyboard cannot be used to type into certain text input objects. These include the secure text input objects (any object that has its secureText property set to YES) and phone pad objects (any object that has a keyboard type trait of UIKeyboardTypePhonePad or UIKeyboardTypeNamePhonePad). When the user types in any of these text input objects, the system temporarily replaces your custom keyboard with the system keyboard, and on typing in a non-secure or non-phone pad object, your keyboard resumes.
Input dictation isn’t possible for a custom keyboard since, like all extensions in iOS 8, it has no access to the device microphone.
Selecting text is also not possible. Text selection is under the control of the app that is using the keyboard.
Closely related to the above point, editing menu options i.e. Cut, Copy, Paste are inaccessible. If an app provides an editing menu interface, the keyboard has no access to it.
App developers can reject the use of custom keyboards in their app. This can especially be done in apps that are sensitive to security such as banking apps.
You cannot display key artwork above the top edge of a custom keyboard’s primary view the same way Apple does when you tap and hold a key in the top view.
and very Important you must follow the Apple Extensions guide
https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html#//apple_ref/doc/uid/TP40014214-CH16-SW1
Enjoy. Happy coding.!!!

Resources