2015-02-24 169 views
0

enter image description here我必須創建一個支持美國手語的自定義鍵盤。爲此,我必須將英文鍵盤的鍵符號轉換爲美國手語符號鍵。所以如何在iOS鍵盤上將(英文字母)翻譯爲ASL-(手形符號)。如何在iOS鍵盤上顯示美國手語(手勢)?

看看這個: How to simulate a sign language keyboard in 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(發件人:的UIButton){

let title = sender.titleForState(UIControlState.Normal) 
    var proxy = textDocumentProxy as UITextDocumentProxy 
    proxy.insertText(title!) 
} 

我希望按鈕標題是手動登錄文本編輯器。

+2

有史以來最好的問題 – 2015-02-24 12:25:15

+1

請添加更多的細節和代碼的一部分將有助於理解這個問題。 – 2015-02-24 12:26:51

+0

向下投票請留下評論。 – 2015-02-24 12:27:26

回答

4

您應該嘗試安裝http://www.lifeprint.com/asl101/pages-layout/gallaudettruetypefont.htm字體並將字體設置更改爲Gallaudettruetype字體。這應該可以解決問題。 雖然我不是一個iOS開發者,但可以幫助你理解logic

Update:如果你可以在你的設備(iPhone,iPad的)安裝的字體,那麼你應該能夠改變輸入型太(鍵盤) 。這將完全解決您的問題。我不知道你會如何做到這一點,但這應該是邏輯,你應該朝這個方向前進。

+0

字體在iOS中不能在網上使用。蘋果允許某些事情,某些事情不會。 – 2015-07-27 04:20:10