Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin: Set UITextField Height

How do I change the height of a text field in Xamarin iOS?

In native iOS, you can set the height on the UITextField outlet manually, like in this answer, but in Xamarin, it doesn't allow you to change that property. Is this possible in Xamarin using an actual UITextField? If not, what's the nicest hack to get something similar?

like image 675
bcstrawn Avatar asked May 22 '14 19:05

bcstrawn


2 Answers

RectangleF in C# is a struct so you will need to make a copy of it, change the value and set it back to the control.

        var f = textField.Frame;

        f.Height = 100f;

        textField.Frame = f;
like image 163
SKall Avatar answered Nov 02 '22 22:11

SKall


Have you tried setting the frame like this?

textField.Frame = new RectangleF (x, y, width, height);
like image 43
Ender2050 Avatar answered Nov 02 '22 22:11

Ender2050