iphone - 为 UITextView 旋转自定义 inputView 的问题

标签 iphone ios uitextview inputview

我编写了一个自定义输入 View ,用于替换 UITextView 的标准键盘。如果我将我的自定义 UIView 指定为我的 UITextViewinputView,它在纵向和横向模式下都按预期工作。

当我旋转设备时出现问题 - 每当我这样做时,我的自定义 UIView 都会展开以填满整个屏幕,而不仅仅是覆盖键盘。我在任何地方都没有为此设置任何自定义大小调整代码 - 我实际上只是将 UIView 指定为 UITextView 的 inputView 属性,然后旋转设备。

如何让我的自定义键盘 View 在我旋转设备时只占用普通键盘占用的空间?

最佳答案

来自 Apple 文档:

You have a lot of flexibility in defining the size and content of an input view or input accessory view. Although the height of these views can be what you’d like, they should be the same width as the system keyboard. If UIKit encounters an input view with an UIViewAutoresizingFlexibleHeight value in its autoresizing mask, it changes the height to match the keyboard.

http://developer.apple.com/library/ios/#Documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/InputViews/InputViews.html#//apple_ref/doc/uid/TP40009542-CH12-SW1

关于iphone - 为 UITextView 旋转自定义 inputView 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6296114/

相关文章:

iphone - 找不到 plist 文件

iphone - viewDidUnload 应该调用 super viewDidUnload 还是 dealloc?

ios - 在 UITextView 中禁用文本选择

ios - 如何使我的键盘弹出窗口更加流畅,我的 View Controller 以模态方式出现?

ios - 多行中行与行之间的核心文本空间

iphone - 在 View 中添加/删除 View 时出现问题

android - 我如何与 Dart 社区联系以提出建议?

iphone - 如何在 iOS 的 UIWebView 上添加 Highcharts?

ios - iOS背景音乐问题

iOS swift 4 OAuth