我必须创建一个支持美国手语的自定义键盘。为此,我必须将英语键盘的键符号转换为美国手语手符号键。那么如何在 iOS 键盘上将(英文字母)翻译成 ASL-(手势)。
看这个: 如何在 IOS 中模拟手语键盘?
我们必须做相反的事情。即键盘上的手势。当用户按下手签名键字母时,它所尊重的字母将显示在文本编辑器中。
提示:手语支持字体。我正在使用“Gallaudet-Regular”字体在键盘键上绘制手形符号。但不能做同样的事情。
注意 - 下面是在 iOS 中创建自定义键盘扩展的代码。当您使用下面的代码时,它将创建一个带有手形符号的键盘按钮,但是当我用来点击键盘键时,它会给出“a”作为文本,但是当我点击时我想要手形符号。
代码:第 1 步:// 创建自定义按钮
self.testingButton = UIButton.buttonWithType(.System) as UIButton
self.testingButton.setTitle(NSLocalizedString("a", comment: "Title for 'First Keyboard' button"), forState: .Normal)
self.testingButton.sizeToFit()
self.testingButton.titleLabel?.font = UIFont(name: "Gallaudet-Regular", size: 50)
self.testingButton.backgroundColor = UIColor.redColor()
self.testingButton.setTranslatesAutoresizingMaskIntoConstraints(false)
self.testingButton.addTarget(self, action: "tapKeyboardButton:", forControlEvents: .TouchUpInside)
self.view.addSubview(self.testingButton)
第 2 步:// 对按钮选择器执行操作
func tapKeyboardButton(sender:UIButton) {
let title = sender.titleForState(UIControlState.Normal)
var proxy = textDocumentProxy as UITextDocumentProxy
proxy.insertText(title!)
}
我希望按钮标题是文本编辑器中的手签。