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

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

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

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

Q&A

1回答

3249閲覧

キーボードがエミュレータで表示されない

abc30

総合スコア36

Swift

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

0グッド

0クリップ

投稿2017/11/12 03:19

編集2017/11/15 03:19

###前提・実現したいこと
SwiftのXcode内のエミュレーターでキーボードが表示されない。
現在、メモアプリを作っている。

###発生している問題・エラーメッセージ
特にエラーは発生していない。

AppDelegate.swiftに
###該当のソースコード

import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var lastText: String? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let userDefaults = UserDefaults.standard lastText = userDefaults.object(forKey: "lastText") as? String return true } func applicationWillResignActive(_ application: UIApplication) { let userDefaults = UserDefaults.standard userDefaults.set(lastText, forKey: "lastText") } func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. } func applicationDidBecomeActive(_ application: UIApplication) { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } }

と書いてViewController.swiftに

import UIKit class ViewController: UIViewController, UITextViewDelegate { @IBOutlet weak var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. textView.delegate = self let appDelegate = UIApplication.shared.delegate as! AppDelegate textView.text = appDelegate.lastText } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func textViewDidChange(_ textView: UITextView) { let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.lastText = textView.text } }

と書いた。
###試したこと
キーボードを表示させるキーボードを押していないのかソースコード上に問題があるのかわからない。

Keyboardの設定がstoryboardのどこにあるのかわからない。現在のstoryboardは
イメージ説明

イメージ説明

のようになっていて、
イメージ説明
を探しているのだが....。

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

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

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

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

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

nakasho_dev

2017/11/12 10:51

「前提・実現したいこと」に何を実現したいのかを具体的に書いてください。(例:画面を開いたときにソフトウェアキーボードが入力状態になること)。「発生している問題・エラーメッセージ」には例外等は発生していないとのことですが、期待した動作にならないことも「問題」として記述ください。「試したこと」には問題を解決するためにどのような試みをしたかや参考にしたサイトを書いてください。
fuzzball

2017/11/13 00:34

Macのキーボードからは文字を入力できますか?実機(iPhone/iPad)ではソフトウェアキーボードが表示されるのでしょうか?
abc30

2017/11/13 12:06

Macからも実機からもキーボード入力ができません
fuzzball

2017/11/14 00:30

念のため確認しますが、TextViewをタップしてますか? タップしたときにカーソルは表示されますか?
abc30

2017/11/14 14:20

はいタップしています。タップしたときにカーソルは表示されません。
fuzzball

2017/11/14 14:34

TextViewのEditableのチェックが外れていませんか?
abc30

2017/11/14 14:43

それはどこから確認できますか?Swift3を使っています。KeyboardのDo not dismiss のことでしょうか?
fuzzball

2017/11/14 14:48

Storyboardです。
abc30

2017/11/15 03:20

質問文にStoryboardの写真を追加しました。Editingが見当たらず。。。ここではないのでしょうか?
fuzzball

2017/11/15 03:50 編集

EditableはText Viewのところにあります。(2枚目の画像)チェックは入っているので問題なさそうです。
abc30

2017/11/15 04:01

なるほど。。。では何が問題なのでしょうか?
fuzzball

2017/11/15 04:07

一度、新規のプロジェクトを作成し、TextViewだけ配置して実行して試してみて下さい。(コードは何も書かなくてかまいません)
guest

回答1

0

こちらの記事にあるように、SimulatorのConnect Hardware Keyboardの設定は外してますか。
https://qiita.com/iwason/items/517865ea9caa872910f8

投稿2017/11/12 04:33

nakasho_dev

総合スコア2655

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

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

abc30

2017/11/12 07:09

チェックは外しています
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問