viernes, 29 de mayo de 2015

UIView BeginAnimation, Animar una imagen CGAffineTransformMakeScale. UIView BeginAnimation, animate a CGAffineTransformMakeScale image.


- (void) viewDidLoad
{
    [super viewDidLoad];
    
    UIImage *imagenAnima = [UIImage imageNamed:@"imagen.png"];
    
    self.imageView = [[UIImageView allocinitWithImage:imagenAnima];
    [self.imageView setFrame:CGRectMake(0.0f,0.0f,50.0f,50.0f)];
    [self.view addSubview:self.imageView];
}


- (void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self iniciarAnimacion];
}

- (void) iniciarAnimacion
{
  
  [UIView beginAnimations:@"moverImagen"  context:(__bridge void *)self.imageView];
  
  [UIView setAnimationDuration:4.0f];
  [UIView setAnimationDelegate:self];
  [UIView setAnimationDidStopSelector: @selector(imageViewDidStop:finished:context:)];
  
  [self.imageView setCenter:self.view.center];
  [self.imageView setTransform:CGAffineTransformMakeScale(5.0f, 5.0f)];
  
  [UIView commitAnimations];
  
}

- (void)imageViewDidStop:(NSString *)paramAnimationID
                finished:(NSNumber *)paramFinished  context:(void *)paramContext{
    
    UIImageView *contextImageView = (__bridge UIImageView *)paramContext;
    NSLog(@"Información de la imágen %@", contextImageView);
    

}

No hay comentarios:

Publicar un comentario