A UITextFieldcan be as high as possible. There is no “preferred” height if you do not have text inside the text field, in which case you can use the method NSString -sizeWithFont::
CGSize size = [textField.text sizeWithFont:[UIFont systemFontOfSize:12]];
CGRect frame = textField.frame;
frame.size = CGSizeMake(textField.frame.size.width, size.height);
textField.frame = frame;
source
share