我有一个 UITextField
我在哪里设置 inputView
到自定义 View 。它的标准高度为 216。我想将其设置为 300 或屏幕的一半。
使用约束不是一个选项,因为它与默认的 216 冲突并且它丢弃了我的约束。
设置框架也不起作用。
有没有办法将其设置为更高的值?
最佳答案
您需要子类 UIInputView
并覆盖 allowsSelfSizing
返回值 真 , 像这样
class MyInputView: UIInputView {
// ... other code
override var inputViewStyle: UIInputViewStyle { get { return .default } }
override var allowsSelfSizing: Bool { get { return true } set{} }
// ... other code
}
关于uitextfield - 如何设置自定义 inputView 的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33261686/