我不知道如何使用requestSupplementaryLexiconWithCompletion,就像这里的苹果开发者网站概述的那样。
我有以下功能
override func requestSupplementaryLexiconWithCompletion(completionHandler: ((UILexicon!) -> Void)!) {
appleLexicon = UILexicon
}我只是迷失了如何获得一个UILexicon,然后看看返回的对值。例如,将它们打印到控制台以查看其输出。
发布于 2014-07-11 12:36:10
你可以试着像这样使用它:
func handler(lexicon: UILexicon!) {
println(lexicon.description)
}
@IBAction func click(sender: AnyObject) {
let controller = UIInputViewController()
controller.requestSupplementaryLexiconWithCompletion(handler)
}或者说:
@IBAction func click(sender: AnyObject) {
let controller = UIInputViewController()
controller.requestSupplementaryLexiconWithCompletion({
lexicon in
println(lexicon.description)
})
}click方法只是一个UIButton抽头事件处理程序。
https://stackoverflow.com/questions/24693929
复制相似问题