如何使用iPhone safari地址搜索栏等动画调整文本字段的大小?

Teo*_*ing 1 iphone

可能与CoreAnimation有关.

有没有人有这样做的例子?好吧,我是CA的新手,所以任何接近这个的例子都会有很大帮助.

Ram*_*min 5

看看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块内的文本字段.