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.
Yes
With iOS 10 Apple added SFSpeechRecognizer which allows for starting speech recognition without user interaction.
You have to implement SFSpeechRecognizer, use Accelerate framework to get mic sound level floats and make an animated view yourself. It will look cooler!
Sorry for not providing the code, I think i lost it. Can’t find it on my multiple hard drives :/
Related
We can set up a focus status with customized turning on time and turning off time. I'd like to be notified when I am in my own app. Unfortunately INShareFocusStatusIntentHandling was not called when a system notification "Focus on" came out. Anybody know some solutions or ideas about it. Thanks ahead!
According to https://developer.apple.com/forums/thread/682143 you need to implement an Intents Extension from your app and have that extension share the results to the main app via UserDefaults or some other method. You cannot observe the focus state changes directly in your app.
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.
Yes
With iOS 10 Apple added SFSpeechRecognizer which allows for starting speech recognition without user interaction.
You have to implement SFSpeechRecognizer, use Accelerate framework to get mic sound level floats and make an animated view yourself. It will look cooler!
Sorry for not providing the code, I think i lost it. Can’t find it on my multiple hard drives :/
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?
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.
I understand this is a bad idea (to show a voice dictation button in the app when it's already on the keyboard when it's available). But I have a client who would really like to have a microphone icon in a text field that would enter voice dictation mode when pressed.
Note, I am talking about the standard OS voice dictation mode (that the keyboard controls).
So the basic question is:
Can I tell the keyboard to enter voice dictation mode?
(my guess is that it's not allowed, but I would love something more "official" than my gut)
This wouldn't be possible unless you were to jailbreak your device. There would be little reason for Apple to offer a public API to do this, because any time you would be able to invoke it is when the keyboard is showing anyway, which would contain the button to activate it.
I'm making a game where a player reacts to sounds via motion - seeing as the visual element isn't needed to play it, and many play with their eyes closed, it seems a shame to not be fully VoiceOver compatible. I'm currently using Cocos2D-iPhone and CocosDenshion for audio, and am now starting to think about how I'll be building my menu system to choose levels and configure controls.
Is it reasonably easy to support VoiceOver in Cocos2D's menu system, or should I look in to trying to create my menus in UIKit which I have no experience using?
I don't know if Cocos' menu system supports VoiceOver, but if it doesn't, you could probably add the functionality you're looking for yourself without having to delve into a lot of UIKit work. All you need to do is create a UIView subclass which gets added to your main window when your app starts up. Then use the UIAccessibilityContainer protocol and UIAccessibilityPostNotification calls to allow users to interact with your game via VoiceOver.
The UIAccessibilityContainer protocol lets you inform VoiceOver what interface elements are currently on the screen, their labels, their traits, etc. VoiceOver then uses this information to let users swipe between elements and get feedback on them.
When your game changes state, you can change what that protocol sends back and then issue a
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil)
...to inform VoiceOver that the screen layout has changed. And to just speak something via VoiceOver, say when your game state has changed, you can send a different notification to speak some text:
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, #"Achievement unlocked!");
No need to go with UIKit framework you can go with the cocos2d native methods and class to implement this.
For sound option we have SimpleAudioEngine Which can be used. you can distinguish between sound using its ID which is of type ALuint.
ALuint soundEffectID;
//to start
soundEffectID=[[SimpleAudioEngine sharedEngine] playEffect:#"my sound"];
//to stop
[[SimpleAudioEngine sharedEngine] stopEffect:soundEffectID];
You have to mange these effect and I think your problem will be solved.