Search code examples
iostextviewautosize

How can I resize textview when I input long text?


I have a textfield in a tableview 's last cell. The textfield is one line at beginning, when I input some text more than one line, I need the textfield change its height for me can view all text. How can I do this?

edit 1: I have try text view, it can input multiple line text, but how can I know when it from one line become two line? because I need resize cell height also.

edit 1 's answer UITextView Auto Height


Solution

  • You can't do something like this with a UITextField because it's intended to be only a field and you can't change its height. Otherwise take a look to UITextView which can be set as you want, its frame etc... You only have to set it as editable so you can write text in it.