UITextField doesn't let you to write more than one line... but you can use UITextView instead, and use the NSString -sizeWithFont function to understand how much space you need.
like this:
CGSize size = [yourTextView.text sizeWithFont:yourTextView.font];
CGRect f = yourTextView.frame;
f.size.height = ceil(size.width/f.size.width)*size.height
yourTextView.frame = f;
I didn't tried this code, but I already used a code like that in the past.
I hope my informations may be useful :)