Search code examples
uitextfieldnslayoutconstraintinputview

How can I set height of custom inputView?


I have a UITextField where I set the inputView to a custom view. This has a standard height of 216. I would like to set this to something like 300, or half the screen.

Using constraints is not an option, as it conflicts with the default 216 and it discards my constraint.

Setting the frame also does not work.

Is there some way to set this to a higher value?


Solution

  • 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.