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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Swift

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

Q&A

1回答

1433閲覧

fieldをタップしたらオリジナルキーボードを出現させ、入力してしまう

Sapporo_Ebina51

総合スコア4

Swift

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

0グッド

0クリップ

投稿2019/12/24 07:17

Xccode10.1、swift4.x
Main.storyboardには、ViewController.swiftで、
@IBOutlet weak var textInput: UITextField!を配置。
KeyboardViewController.swiftとKeyboardView.xibでキーボードを実現。

該当のソースコード

KeyboardViewController.swiftのソース

import UIKit

class KeyboardViewController: UIInputViewController {

@IBOutlet var nextKeyboardButton: UIButton! override func updateViewConstraints() { super.updateViewConstraints() let v = UINib(nibName:"KeyboardView", bundle:nil).instantiate(withOwner: self,options:nil)[0] as! UIView self.inputView?.addSubview(v) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated } override func textWillChange(_ textInput: UITextInput?) { // The app is about to change the document's contents. Perform any preparation here. } override func textDidChange(_ textInput: UITextInput?) { // The app has just changed the document's contents, the document context has been updated. } @IBAction func buttonNext(sender: AnyObject) { self.advanceToNextInputMode() } @IBAction func button1(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button1") } @IBAction func button2(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button2") } @IBAction func button3(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button3") } @IBAction func button4(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button4") } @IBAction func button5(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button5") } @IBAction func button6(sender: AnyObject) { let proxy = textDocumentProxy as UITextDocumentProxy proxy.insertText("Button6") }

}

試したこと

Main.storyboardのtextInputフィールドを選んだら、オリジナルのキーボードを実現させる。

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

回答1

0

このチュートリアルの通り作ってみてください:
Custom Keyboard Extensions: Getting Started

投稿2019/12/25 07:36

vanderlvov

総合スコア685

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

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

Sapporo_Ebina51

2019/12/25 07:55

ご指定いただいたチュートリアルは、私には難しすぎて歯が立たないようです。 日本語で、手順に沿ったページはありますか。書籍はいくつか試しました。
vanderlvov

2019/12/25 08:23

先ず、質問をずマークダウンの形式にしていただければと思います:https://teratail.com/help#about-markdown そして、www.raywenderlich.comにて無料アカウントを作成して、完成したコードをダウンロードできます。そのコードをいじったりカスタマイズしたりして、作りたいキーボードを作成できると思います。いかがでしょうか。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問