I need to increase a text field\'s width according to its content. When the user inputs text, then the textfield size should increase automatically. I have one close (X) but
I think this is a better solution than having a width constraint that you have to modify:
Resize a UITextField while typing (by using Autolayout)
- (IBAction) textFieldDidChange: (UITextField*) textField
{
[UIView animateWithDuration:0.1 animations:^{
[textField invalidateIntrinsicContentSize];
}];
}
You can omit the animation if desired..
EDIT: Here's an example project: https://github.com/TomSwift/growingTextField