当我运行模拟器并在UITextView中单击时,键盘不会显示。如何重新启用键盘?
它曾经有效,但现在不行了——我不知道我可能偶然点击了什么。
当我运行模拟器并在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
其他回答
在不检查代码的情况下,很难说您的代码是否有任何问题,但在(版本6.0(6A216f))中,这种情况经常发生在我身上。我通常必须重置模拟器的内容和设置和/或重新启动xCode以使其再次工作。试试这些,看看能不能解决问题。
简单的方法就是按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键打开,则将模拟器重置为出厂设置。转到模拟器菜单设备->擦除所有内容和设置。。它将解决键盘无法打开的问题。