UIView
)将包含显示的图像视图,并在触摸时在它们之间交换(实现触摸事件或使用图像视图上方的按钮或使用按钮而不是图像视图)。
接下来是用于在一个容器视图中交换两个图像视图的示例代码(如上所述):
// 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];