Estoy tratando de transformar un UISearchBar, como en Mobile Safari: toque en el campo de búsqueda y crece mientras el campo de ubicación se reduce.UIView Animación anima la posición pero no el ancho
Mi animación actual para modificar el ancho y la posición del campo de búsqueda solo anima la posición: justo antes de que se deslice hacia el lugar correcto, simplemente se ajusta al ancho correcto. Aquí está mi código:
[UIView beginAnimations:@"searchGrowUp" context:nil];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationDelegate:self];
CGFloat findFieldWidth = findField.frame.size.width;
CGFloat urlFieldWidth = urlField.frame.size.width;
CGRect findFieldFrame = findField.frame;
CGRect urlFieldFrame = urlField.frame;
findFieldFrame.origin.x = findFieldFrame.origin.x - 150.0f;
findFieldFrame.size.width = findFieldWidth + 150.0f;
urlFieldFrame.size.width = urlFieldWidth - 150.0f;
urlField.frame = urlFieldFrame;
findField.frame = findFieldFrame;
[UIView commitAnimations];
He modificado ligeramente este código en aras de presentar aquí, pero espero que esto da la esencia.
¡Se agradecerán todas las conjeturas sobre por qué sucede esto!
Cheers, Aaron.
¡Esto mejor no sea para Macinsite! :> –