UISearchBar and dictation support
Asked Answered
J

1

7

I have user interface with UISearchBar and I implement the UISearchBarDelegate's searchBarSearchButtonClicked: to perform the search. I do not have a device with dictation support to test this, so I'm going to speculate here...

On devices with dictation support, I would like to perform the search as soon as the dictation ends, without requiring the user to hit the search button manually.

  • Does this work out-of-the-box?
  • Or do I need to handle it programmatically?

Since iOS 5.1, there are new methods in UITextInput protocol and I could theoretically hook onto dictationRecordingDidEnd. Is that the way to go?

Journalize answered 18/7, 2012 at 9:11 Comment(0)
S
5

Yes, you would want to use the dictationRecordingDidEnd protocol method. Apple's documentation says this about dictationRecordingingDidEnd:

Implement this optional method if you want to respond to the completion of the recognition of a dictated phrase.

That said, I have yet to find in Apple's human interface guidelines anything that talks about the expected use of this method.

You may also want to look at dictationRecongitionFailed as well as the UIDictationPhrase class.

Syncopate answered 14/8, 2012 at 3:59 Comment(3)
Can you confirm, that entering a phrase into UISearchBar using dictation does not automatically trigger the Search (i.e. searchBarSearchButtonClicked) on iPhone 4S?Journalize
Using the built in dictation on my iPad did not automatically trigger a search.Syncopate
I can confirm that searchBarSearchButtonClicked is not called automatically after dictation is finishedFosse

© 2022 - 2024 — McMap. All rights reserved.