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

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


当前回答

使用脚本您可以通过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

其他回答

使用脚本您可以通过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

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

如果模拟器的键盘未通过按K键打开,则将模拟器重置为出厂设置。转到模拟器菜单设备->擦除所有内容和设置。。它将解决键盘无法打开的问题。

在移除新模拟器硬件选项时,

如果要手动查找键盘选项,请单击I/O部分,

I/O->键盘->切换软件键盘(¨K)

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

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