当我运行模拟器并在UITextView中单击时,键盘不会显示。如何重新启用键盘?

它曾经有效,但现在不行了——我不知道我可能偶然点击了什么。


当前回答

这对我有用。单击I/O,然后单击键盘。当取消选择“连接硬件键盘”时,模拟器键盘将弹出。

其他回答

简单的方法就是按command+k

如果模拟器中没有自动显示键盘,只需按[Command+K]

或硬件->键盘->切换软件键盘

使用脚本您可以通过Xcode预运行操作运行

/usr/libexec/PlistBuddy -c "Print :DevicePreferences" 
~/Library/Preferences/com.apple.iphonesimulator.plist | perl -lne 'print 
$1 if /^    (\S*) =/' | while read -r a; do /usr/libexec/PlistBuddy -c 
"Set :DevicePreferences:$a:ConnectHardwareKeyboard false" 
~/Library/Preferences/com.apple.iphonesimulator.plist || /usr/libexec/PlistBuddy -c  "Add :DevicePreferences:$a:ConnectHardwareKeyboard bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist; done

要启用/禁用模拟器键盘:单击⇧+⌘+K在模拟器上显示键盘,再次单击以禁用(隐藏)键盘。

⇧+⌘+K

OR

模拟器->I/O->键盘->切换软件键盘

在ios8测试版模拟器中进行测试时,您可以在“软件键盘”和“硬件键盘”之间切换。

更新:从iOS模拟器8.0开始,快捷方式是⇧+⌘+K