質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

Q&A

0回答

480閲覧

カスタムキーボードのボタン

shinya-ta

総合スコア31

Objective-C

Objective-Cはオブジェクト指向型のプログラミング言語のひとつです。C言語をベースにSmalltalkが取り入れられています。

Xcode

Xcodeはソフトウェア開発のための、Appleの統合開発環境です。Mac OSXに付随するかたちで配布されています。

Swift

Swiftは、アップルのiOSおよびOS Xのためのプログラミング言語で、Objective-CやObjective-C++と共存することが意図されています

0グッド

0クリップ

投稿2020/05/17 01:54

この度、サンプルコードを使って、カスタムキーボードを作り、実機でのテストに成功しました。
ただ、このアプリは全盲の嫁の為のアプリで、iPhoneでVoice Overを使用して使うことを前提にしてます。
Voice Overを起動させると、タップはおろか、読み上げにも反応しません。
これを対処するには、コードの追加が必要なのでしょうか?

#import "KeyboardViewController.h" #import "Keyboard.h" @interface KeyboardViewController () @property (strong,nonatomic) Keyboard *keyboard; @end @implementation KeyboardViewController - (void)updateViewConstraints { [super updateViewConstraints]; // Add custom view sizing constraints here } - (void)viewDidLoad { [super viewDidLoad]; // Perform custom UI setup here self.keyboard = [[[NSBundle mainBundle] loadNibNamed:@"Keyboard" owner:nil options:nil]objectAtIndex:0]; [self addGesturesToKeyboard]; self.inputView = self.keyboard; } - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; } - (void)textWillChange:(id<UITextInput>)textInput { // The app is about to change the document's contents. Perform any preparation here. } - (void)textDidChange:(id<UITextInput>)textInput { // The app has just changed the document's contents, the document context has been updated. UIColor *textColor = nil; if (self.textDocumentProxy.keyboardAppearance == UIKeyboardAppearanceDark) { textColor = [UIColor whiteColor]; } else { textColor = [UIColor blackColor]; } } #pragma mark Keyboards - (void)addGesturesToKeyboard{ [self.keyboard.deleteKey addTarget:self action:@selector(pressDeleteKey) forControlEvents:UIControlEventTouchUpInside]; [self.keyboard.spaceKey addTarget:self action:@selector(pressSpaceKey) forControlEvents:UIControlEventTouchUpInside]; [self.keyboard.returnKey addTarget:self action:@selector(pressReturnKey) forControlEvents:UIControlEventTouchUpInside]; //Change to next keyboard [self.keyboard.globeKey addTarget:self action:@selector(advanceToNextInputMode) forControlEvents:UIControlEventTouchUpInside]; for (UIButton *Key in self.keyboard.keysArray) { [Key addTarget:self action:@selector(pressKey:) forControlEvents:UIControlEventTouchUpInside];} } - (void)pressDeleteKey{ [self.textDocumentProxy deleteBackward]; } -(void)pressSpaceKey{ [self.textDocumentProxy insertText:@" "]; } -(void)pressReturnKey{ [self.textDocumentProxy insertText:@"\n"];} -(void)pressKey:(UIButton *)key{ [self.textDocumentProxy insertText:[key currentTitle]]; } @end

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問