#pragma 注意:转场动画一定要写在转场代码里面,不然没有效果的
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// 转场代码
if (i == 4) {
i = 1;
}
// 加载图片名称
NSString *imageN = [NSString stringWithFormat:@"%d",i];
_imageView.image = [UIImage imageNamed:imageN];
i++;
// 转场动画
CATransition *anim = [CATransition animation];
/* The name of the transition. Current legal transition types include
* `fade', `moveIn', `push' and `reveal'. Defaults to `fade'. */
// anim.type = @"pageCurl";
anim.type = @"moveIn";
anim.duration = 0.8;
[_imageView.layer addAnimation:anim forKey:nil];
}
转场动画
最新推荐文章于 2024-05-06 09:15:28 发布