Iphone – How to resize textfield with animation like the iPhone safari address-search bar


Probably has something to do with CoreAnimation.

Does anybody have any example to do something like this?
Well I'm new to CA so any example that is close to this will help a lot.

Best Solution

Take a look at UIView animations. Here's an example:

CGRect newBounds = myTextField.bounds;
newBounds.size.width = NEWSIZE; //whatever you want the new width to be

[UIView beginAnimations:nil context:nil];
myTextField.bounds = newBounds;
[UIView commitAnimations];

To put it back, save the original bounds and assign it back to the text field inside a begin/commitAnimations block.