Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

how to change UITextField's height

Am trying to make my text field a bit bigger but i can only control the width not the height, any tips ?

3 Answers

Stone Preston
Stone Preston
42,016 Points

this post explains how to do it in code as well as storyboard if you scroll down a bit

looks like you have to use a height constraint if you want to do it in storyboard

Yea thanks, i found the answer by Brian, changing the border type allowed me to alter the height

Matthew Mascioni
Matthew Mascioni
20,444 Points

Hm, that's strange! If you're using Interface Builder, go to 'Product' > 'Clean' to clean the build folder first.

If you're doing it through code, you could theoretically force the height to change by modifying its frame rectangle. I'm going to assume you've already declared a UITextField named textField:

[textField setFrame:CGRectMake(textField.frame.origin.x, textField.frame.origin.y, textField.frame.size.width, new height)];

Hope that helps! If it doesn't, post your code and someone will try and help you out further :)

Hi Matthew, I was using the interface builder for the Build a Self-Destructing App. The only solution was changing the border type.

Matthew Mascioni
Matthew Mascioni
20,444 Points

Neat! Glad you got it solved :)