uitextinput

Using Dictation - iOS 6 - DidStart?

丶灬走出姿态 提交于 2019-12-05 00:12:20
问题 How to respond to starting dictation? Known ways of responding to dictation: dictationRecordingDidEnd - respond to the completion of the recognition of a dictated phrase. dictationRecognitionFailed - respond to failed dictation recognition. Reference: UITextInput Protocol Reference Starting in iOS 5.1, when the user chooses dictation input on a supported device, the system automatically inserts recognized phrases into the current text view. Methods in the UITextInput protocol allow your app

UITextInput setMarkedText:selectedRange not working? (Can't be!)

泄露秘密 提交于 2019-12-04 06:12:24
I want to set the marked text programmatically and since iOS5 UITextView and UITextField conform to UITextInput this should be possible but for some reason I always get the markedText to be nil. :( What am I missing here? This is what I've tried without success: (While the textview is firstResponder) 1.- When the text view contains no text: text: "", selectedRange : {0,0}, markedText: nil. [_textView setMarkedText:@"月" selectedRange:NSMakeRange(0, 1)]; Result: text : "", selectedRange: {0,0}, markedText: nil. (Nothing changed) 2.- When the text view contains text + some marked text: text :

UITextInput: selectedTextRange vs. markedTextRange?

对着背影说爱祢 提交于 2019-12-04 06:08:17
Ok, so I know Apple's UITextInput protocol requires the two UITextRange properties selectedTextRange and markedTextRange and the documentation says that selectedTextRange is a subrange of markedTextRange which is an uncomfirmed text range by the user yatta yatta. That still doesn't make some things clear to me regarding how I ought to implement the two text ranges differently. Could someone visually explain to me the difference between selectedTextRange and markedTextRange ? I know that when the length of selectedTextRange is 0 it indicates a blinking caret at selectedTextRange 's location .

Adding a cancel button to UITextField keyboard

假装没事ソ 提交于 2019-12-04 00:32:36
问题 Is there a way to add a cancel button to the keyboard displayed for UITextField ? Looking over the UITextInputTraits Protocol Reference, I could not find anything, including trying out the different keyboard types. 回答1: You can create a input accessory view which can display a UIToolBar Above the keyboard and then add a cancel button to this. Take a look at the documentation link below for the inputAccessoryView property. http://developer.apple.com/library/ios/#documentation/uikit/reference

Using Dictation - iOS 6 - DidStart?

与世无争的帅哥 提交于 2019-12-03 14:26:49
How to respond to starting dictation? Known ways of responding to dictation: dictationRecordingDidEnd - respond to the completion of the recognition of a dictated phrase. dictationRecognitionFailed - respond to failed dictation recognition. Reference: UITextInput Protocol Reference Starting in iOS 5.1, when the user chooses dictation input on a supported device, the system automatically inserts recognized phrases into the current text view. Methods in the UITextInput protocol allow your app to respond to the completion of dictation, as described in “Using Dictation.” You can use an object of

Custom Input View in Swift

旧时模样 提交于 2019-12-03 03:37:22
I've spent hours trying to figure out how to create/then get a custom inputView to work. I have a grid of TextInputs (think scrabble board) that when pressed should load a custom inputView to insert text. I've created a .xib file containing the UI elements for the custom inputView . I was able to create a CustomInputViewController and have the inputView appear but never able to get the actual TextInput to update it's value/text . Apple documentation has seemed light on how to get this to work and the many tutorials I've have seen have been using Obj-C (which I have been unable to convert over

Replacing character after each type in UITextField?

假装没事ソ 提交于 2019-12-01 11:37:29
问题 I have a UITextField in which the user is expected to type a sentence which we tell the user to type. So the sentence to type is already known to us. Midway of the sentence, the user has to secretly pass a message. The way to do this is by typing a few letters of the already known sentence and then type '&' followed by WhichEverMessageUserWantsToPass and '&' to end. The catch is the moment the user presses '&', whatever he types after that should not be displayed, instead each letter he types

How can I programmatically dismiss the autocorrect popover in a UITextView?

核能气质少年 提交于 2019-11-30 16:45:30
I'm doing some custom auto-complete stuff on my own with insertText: , but if there's an autocorrect suggestion visible the view gets into a weird state. If I use [textView unmarkText] , it dismisses the autocorrect popup thingy -- but it accepts the autocorrection (which is bad). Is there some way to programmatically reject the autocorrect suggestion? My current "solution" works, but it's gross and hacky and I have no reason to assume it will continue to work in the future. Is there a better way to do this? - (void)dismissAutocorrectSuggestionForTextView:(UITextView *)textView { NSRange range

UITextField begin dictation

筅森魡賤 提交于 2019-11-29 09:20:23
I'd like to programmatically put my UITextField input into dictation mode, without requiring the user to bring up and select dictation from the keyboard. Searched the API documentation but can find no solution. Any ideas? This is currently not possible on iOS. The only place where it is kind of possible is in an app using WatchKit. In WKInterfaceController you can actually use presentTextInputControllerWithSuggestions with nil as parameter which starts dictation input immediately. You have to implement SFSpeechRecognizer, use Accelerate framework to get mic sound level floats and make an

Tap Gesture on part of UILabel

余生颓废 提交于 2019-11-28 11:29:21
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<words*2-1;i++){// *2 since UITextGranularityWord considers a whitespace to be a word UITextPosition *pos2 = [textView.tokenizer positionFromPosition:pos toBoundary:UITextGranularityWord inDirection:UITextLayoutDirectionLeft]; UITextRange *range = [textView textRangeFromPosition:pos toPosition:pos2]; CGRect resultFrame = [textView firstRectForRange:(UITextRange *)range ]; UIView* tapViewOnText = [[UIView alloc] initWithFrame