在 UITextView 上以编程方式禁用 iOS8 Quicktype 键盘 [英] Disable iOS8 Quicktype Keyboard programmatically on UITextView
问题描述
我正在尝试为 iOS8 更新一个具有聊天界面的应用程序,但新的 Quicktype 键盘隐藏了文本视图,因此我想以编程方式或在界面构建器中将其关闭.
I'm trying to update an app for iOS8, which has a chat interface, but the new Quicktype keyboard hides the text view, so I would like to turn it off programmatically or in interface builder.
是否有可能以某种方式或只有用户可以在设备设置中将其关闭?
Is it possible somehow or only the users can turn it off in the device settings?
我知道有一个问题/答案可以用 UITextfield
解决这个问题,但我需要用 UITextView
来解决这个问题.
I know there is a question/answer which solves this problem with a UITextfield
, but I need to do it with a UITextView
.
推荐答案
您可以禁用 UITextView 的键盘建议/自动完成/QuickType,它可以阻止小屏幕上的文本,如本例所示的 4S
You may disable the keyboard suggestions / autocomplete / QuickType for a UITextView which can block the text on smaller screens like the 4S as shown in this example
带有以下行:
myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
此外,如果您只想在特定屏幕上执行此操作,例如针对 4S
And further if youd like to do this only on a specific screen such as targeting the 4S
if([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
if (screenHeight == 568) {
// iphone 5 screen
}
else if (screenHeight < 568) {
// smaller than iphone 5 screen thus 4s
}
}
这篇关于在 UITextView 上以编程方式禁用 iOS8 Quicktype 键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!