我即将为儿童开发一款记忆游戏,我想知道如何在动画之间翻转两个UIImage? 任何帮助..
答案 0 :(得分:0)
你应该有一个视图(UIView
),它将包含显示的图像视图,并在触摸时交换它们(实现触摸事件或使用图像视图上方的按钮或使用按钮而不是图像视图)
接下来是在一个容器视图中交换2个图像视图的示例代码(如上所述):
// setup the animation group
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.75];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(transitionDidStop:finished:context:)];
// swap the views and transition
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:containerView cache:YES];
[imageView1 removeFromSuperview];
[containerView addSubview:imageView2];
[UIView commitAnimations];
您还可以通过Apple查看带有工作示例的Elements示例项目...