Questions tagged [uitextinput]

UITextInput is an iOS protocol that defines behaviors for interacting with and responding to text selection, autocorrection, and other text input events.

UITextInput is an iOS () protocol that defines behaviors for interacting with and responding to text selection, autocorrection, and other user text input events. It allows conforming classes to respond to dictation (on iOS 5.1+), modify selected text, position the selection UI elements, etc. UITextField () and UITextView () are the two most commonly used classes that conform to the protocol.

For more information, please see the Apple Documentation for UITextInput.

89 questions
5
votes
0 answers

iOS: How do QuickType keyboard suggestons work with the UITextInput protocol?

We have a text-entry view implemented using the UITextInput, UIKeyInput and UITextInputTraits protocols. Basic text entry and deletion work fine, via insertText: and deleteBackward. However, QuickType suggestions are not received by these methods,…
bright
  • 4,700
  • 1
  • 34
  • 59
5
votes
1 answer

Custom UITextInput implementation not showing multi-stage input suggestions

I have a custom UITextInput-based text editor. It works very well, except for multi-stage input via marked text. My marked region renders correctly, and marked text is inserted, but the candidate list above the keyboard is blank. For example, here…
simeon
  • 4,466
  • 2
  • 38
  • 42
5
votes
5 answers

Tap Gesture on part of UILabel

I could successfully add tap gestures to a part of UITextView with the following code: UITextPosition *pos = textView.endOfDocument;// textView ~ UITextView for (int i=0;i
n00bProgrammer
  • 4,261
  • 3
  • 32
  • 60
5
votes
1 answer

Tokenizer of UITextInput, what is it used for?

I'm implementing a custom text input view, which adopts UITextInput protocol, when using UITextView, double tap a word make the word selected, I wonder how UITextInput use its tokenizer to tokenize the string, by now I didn't see any difference with…
CarmeloS
  • 7,868
  • 8
  • 56
  • 103
5
votes
1 answer

Undo operation with NSUndoManager in rich UITextView (iOS 6)

I want to change some or all of the attributed text of a rich UITextView (iOS 6), and allow the user to undo the change. After reading NSUndoManager documentation, I tried the first way: “Simple undo” based on a simple selector with a single…
Guillaume
  • 21,685
  • 6
  • 63
  • 95
4
votes
2 answers

UITextInputMode.activeInputModes() crashes in Swift 2

I want to get UITextInputMode in Swift 2 but UITextInputMode.activeInputModes() crashes. let x = UITextInputMode.activeInputModes() // crash here for t in x { print(t) }
aotian16
  • 767
  • 1
  • 10
  • 21
4
votes
0 answers

App getting crashed while using dictation in UITextView

The app is getting crashed while using dictation in UITextView . While using dictation feature in keyboard the text is getting auto saved and the application getting crashed due to the same reason. Normal Scenario: While user uses keyboard to enter…
rajthar
  • 41
  • 2
4
votes
2 answers

Xcode: Creating a custom keyboard just for my own app

I am developing a math application. So I need a specific keyboard. I just could take the decimal pad, but there is missing the positive/negative ("+/-") button. Now I want to program a custom keyboard or I would like to edit the decimal pad. What…
Benjamin1956
  • 1,883
  • 2
  • 12
  • 12
4
votes
1 answer

How to detect that the user has used speech input in iOS?

I would like to detect when the user uses the iOS keyboard microphone to add text to a UITextField. So, after the keyboard comes up for text input, as soon as they use the dictation microphone even once, a flag will be set indicating that they have…
Brian Colavito
  • 881
  • 2
  • 9
  • 19
3
votes
2 answers

UITextInput protocol usage for UITextField and UITextView to manage selection results in crash

UITextField and UITextView both adopt the UITextInput protocol. UITextView's selectedRange property returns NSRange, where UITextField doesn't have any selection properties/methods. I'd like to use one routine to manage insertion in either…
Sofi Software LLC
  • 3,879
  • 1
  • 36
  • 34
3
votes
2 answers

iOS13: Is there a way to disable the new swipe to type feature?

I have an app that implements a custom text view by using the UITextInput, UIKeyInput and UITextInputTraits protocols. If you've installed iOS13, you've seen that the keyboard has a snazzy new feature that lets you swipe across the keys to type.…
Ser Pounce
  • 14,196
  • 18
  • 84
  • 169
3
votes
1 answer

iOS UITextInput control: Receiving forward-delete key from hardware keyboard

I have implemented a complicated UITextInput that works quite well on iOS save for one missing feature: when the user has a hardware keyboard connected (at least, in the simulator) and no text is selected, and presses Forward Delete, nothing…
Jared Updike
  • 7,165
  • 8
  • 46
  • 72
3
votes
1 answer

UITextInput returns nil position only in iOS 9

I am trying to get the rect of a specific range (UITextRange). The problem is that the code works fine with iOS 10 , and I am getting the range and rect. Unfortunately with iOS 9 the line : if let rangeStart = textInput.position(from:…
PoolHallJunkie
  • 1,345
  • 14
  • 33
3
votes
3 answers

How to programmatically enter text in UITextView at the current cursor position

I would like to add (some predefined) text at the current cursor position in a UITextView using Swift. So if I have a UITextField named txtField that has some text in it already such as "this is a beautiful valley" and I tap in the area between "a"…
3
votes
1 answer

Problems with protocol implementation

What I am trying to implement is a UITextField that sees words as characters. Specifically, im trying to see the mathemathical expression sin( as one character for example. I thought to solve this problem by implementing my own UITextInputDelegate.…