看看UIView动画.这是一个例子:
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];
Run Code Online (Sandbox Code Playgroud)
要将其放回原处,请保存原件bounds并将其分配回begin/commitAnimations块内的文本字段.