[英]How to start and stop dictation in Apple Watch witout pressing button
我编写代码在我的苹果手表上使用听写。 我使用presentTextInputControllerWithSuggestions而没有建议直接开始听写。
但是,我有两个问题:
有我的代码:
func dictation(){
self.presentTextInputControllerWithSuggestions([], allowedInputMode: WKTextInputMode.Plain, completion:{
(results) -> Void in
//myCode
})
}
override func willActivate(){
super.willActivate()
dictation()
}
你有解决方案吗?
谢谢你的帮助@Feldur
我试着延迟,似乎工作
有我的代码:
override init(){
super.init()
print("start init")
let seconds = 1.0
let delay = seconds * Double(NSEC_PER_SEC) // nanoseconds per seconds
let dispatchTime = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
dispatch_after(dispatchTime, dispatch_get_main_queue(), {
self.dictation()
})
print("end init")
}
有我的日志:
start init
end init
start awakeWithContext
end awakeWithContext
start willactivate
end willactivate
start didAppear
end didAppear
start dictation
我的屏幕出现之后,我的听写开始了。
当用户停止说话时,您是否有停止听写的想法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.