在我的 Apple Watch 应用程序中,我需要输入文本,那么有什么方法可以使用 voiceOver 或任何其他方式在我的应用程序中输入文本吗?
正如我所见,WKInterfaceController 中的所有对象都不支持可编辑的文本输入,例如 UITextfield 或 UITextview。
最佳答案
上面的答案没有代码,只有指向 Apple 出色的 XD 文档的链接。 您可以使用此代码(WatchOS2、iOS 9.2.1)启动带有一些语音选项的语音识别菜单:
//LAUNCH VOICE DICTATION (physical device only)
func launchVoiceDictationMenu(){
self.presentTextInputControllerWithSuggestions(["Hello","Goodbye","Hey"], allowedInputMode: WKTextInputMode.Plain,
completion:{(results) -> Void in
let aResult = results?[0] as? String
print(aResult)
})
}
关于ios - 有没有办法在Apple Watch中输入文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29115136/