Estoy creando un menú y quiero que los botones "aparezcan", supongo, en la pantalla. Básicamente quiero comenzar en dimensiones de 0px y luego subir al tamaño completo de los botones. Puedo animar el alfa y la posición si quiero pero no puedo hacer las dimensiones y creo que es porque es una imagen en el botón.UIButton cambiar el tamaño con la animación
Si realizo un UIButtonTypeRoundRect, puede ver el botón animado detrás de la imagen pero la imagen es estática.
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setBackgroundImage:[UIImage imageNamed:@"settings.png"] forState:UIControlStateNormal];
button.frame = CGRectMake(20, 20, 0, 0);
button.alpha = 0;
[self.view addSubview:button];
CGRect frame = button.frame;
[UIView beginAnimations:@"button" context:nil];
[UIView setAnimationDuration:1];
button.alpha = 1;
frame.size.width += 53;
frame.size.height += 53;
button.frame = frame;
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
Así que el Alpha funciona pero el cambio de tamaño no. También he jugado con stretchableImageWithLeftCapWidth para intentar darle contexto o algo así, pero fue en vano.
Saludos por su ayuda.
¿Has intentado con el botón 'Scale To Fill'? – iwasrobbed
sí, recuerda intentar eso en un momento. ¿Quién te robó? – Rudiger