Reputation: 11
I use new inline Date Picker that is available from iOS 13.4 as inputView for Text Field(before I used wheels). However, it looks broken as the height of inputView is constant: How it looks
I have tried changing the frame and disable AutoResizingMaskIntoConstraints. It didn't help. The way it should work is like a default inline datePicker. How dataPicker should look like
To sum up, I need to increase the height of custom InputView for UITextField.
Upvotes: 1
Views: 967
Reputation: 1
let scrWidth = UIScreen.main.bounds.width
textField.inputView?.frame.size = CGSize(width: scrWidth, height: scrWidth + 50)
datePicker.frame = CGRect(x: 0, y: 0, width: scrWidth , height: scrWidth + 50)
Upvotes: 0
Reputation: 1
I Guess it was limited by default height of inputView. Just change the Size of it then works.
// You can change value as you want. I think same with screen width is better for me.
let scrWidth = UIScreen.main.bounds.width
textfield.inputView?.frame.size = CGSize(width: scrWidth, height: scrWidth)
// Changing CGRect also can work
textfieldinputView?.frame = CGRect(x: 0, y: 0, width: scrWidth , height: scrWidth)
Interesting, when I tested on SE1, it showed up as normal without using above method, and the inputView size was 320*353.3
But the height of other devices larger than it will limited to some value (IDK what is the reference.)
The limitation here was 355.666667, and the size would be 414*355.6667
So that's why I guess dataPicker just get cropped when scaled up.
Upvotes: 0