淡出UIImageView,然后自动将其重新输入

时间:2012-10-29 13:25:39

标签: fade

嗨,大家好我试图在褪色到alpha 0后自动恢复图像,但无法弄明白。

[UIImageView beginAnimations:nil context:NULL];

[UIImageView setAnimationDuration:4.0];

[_imageflushdownwater setAlpha:0];
self.imageflushdownwater.transform = CGAffineTransformRotate(_imageflushdownwater.transform, M_PI / 1);
[UIImageView commitAnimations];

提前致谢。

1 个答案:

答案 0 :(得分:1)

你不必弄清楚,只需通读UIView's class reference...就可以了(请!非常好!)

反正...

使用旧的基于类的API( 使用的那个):

[UIView setAnimationTarget:self];
[UIView setAnimationDidStopSelector:@selector(animationFinished:completed:context:)];


- (void)animationFinished:(NSString *)name completed:(NSNumber *)completed context:(void *)ctx
{
    imageView.alpha = 1.0f;
    imageView.transform = CGAffineTransformIdentity;
}

使用新的基于块的API(应该使用的那个):

[UIView animateWithDuration:4.0 animations:^{
    imageView.alpha = 0.0;
    imageView.transform = CGAffineTransformMakeRotation(M_PI);
} completion:^{
    imageView.alpha = 1.0f;
    imageView.transform = CGAffineTransformIdentity;
}];