How can I set height of custom inputView?
You need subclassed UIInputView
and overrided allowsSelfSizing
for return value true, like this
class MyInputView: UIInputView {
// ... other code
override var inputViewStyle: UIInputViewStyle { get { return .default } }
override var allowsSelfSizing: Bool { get { return true } set{} }
// ... other code
}
I got it to work by setting the autoResizingMask
to None
, and setting the frame
to the desired frame (using UIScreen.mainScreen
to get the width of the screen). I did both these things before layoutSubviews
gets called.