Me hice cargo e hice un screencast también. Was this what you had in mind?
Pongo la animación repitiéndose indefinidamente para que sea más fácil de capturar con un video, pero se puede iniciar presionando un botón, y congelada en su lugar, mostrando el popover y su contenido, hasta que se invierte estar escondido de nuevo
Utilicé Core Animation para eso, en lugar de animar un UIView, ya que quería usar la propiedad mask de CALayer para ocultar el popover y revelarlo con una animación deslizante.
Aquí está el código que utilicé (igual que en el video):
- (void)viewDidLoad
{
// Declaring the popover layer
CALayer *popover = [CALayer layer];
CGFloat popoverHeight = 64.0f;
CGFloat popoverWidth = 200.0f;
popover.frame = CGRectMake(50.0f, 100.0f, popoverWidth, popoverHeight);
popover.contents = (id) [UIImage imageNamed:@"popover.png"].CGImage;
// Declaring the mask layer
CALayer *maskLayer = [CALayer layer];
maskLayer.frame = CGRectMake(0, - popoverHeight, popoverWidth, popoverHeight);
maskLayer.backgroundColor = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f].CGColor;
// Setting the animation (animates the mask layer)
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position.y"];
animation.byValue = [NSNumber numberWithFloat:popoverHeight];
animation.repeatCount = HUGE_VALF;
animation.duration = 2.0f;
[maskLayer addAnimation:animation forKey:@"position.y"];
//Assigning the animated maskLayer to the mask property of your popover
popover.mask = maskLayer;
[self.view.layer addSublayer:popover];
[super viewDidLoad];
}
NOTA: Usted tiene que importar el marco QuartzCore en su proyecto y escribir esta línea en su archivo de cabecera: #import <QuartzCore/QuartzCore.h>
.
Indica si esto funciona para usted o si necesita más ayuda para configurarlo.
¿Cómo puedo mantener la animación agregada después de que se muestre en lugar de repetirla? Gracias. –