Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IS there a way to increase the height of the text field apart from increasing the font size

I am trying to increase the height of the UITextField in my app through IB. I have defined these textfield in my IB so i think it needs to be done through IB. Please let me know if there is a way to do it either through IB or through code.

Thanks,

like image 455
Ashutosh Avatar asked Jan 20 '23 01:01

Ashutosh


2 Answers

As UITextField subclasses UIView, it inherits UIView's initWithFramemethod.

NSInteger myCustomHeight = 237;
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 200, myCustomHeight)];

If u want do do it through IB then replace the last line with:

textField.frame = CGRectMake(10, 10, 200, myCustomHeight);

This assumes textField is an IBOutlet.

like image 106
Sabobin Avatar answered Jan 30 '23 01:01

Sabobin


Increasing the height of UITextField is possible. But you cannot get text on next line, you can write text on only one line. It you want to have Textfield look alike you can use UITextView with editing option where you can increase the height and can have text on multiple lines.

like image 36
insomiac Avatar answered Jan 30 '23 02:01

insomiac