我有一个扩展的UIView类动画代码:如何做两个以上的UIViews之间的翻转动画?
// Start Animation Block
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:nil context:context];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:[self superview] cache:YES];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDuration:1.0];
//int nextView = currentView + 1;
// Animations
[[self superview] exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
//And so I would do: [[self superview exchangeSubviewAtIndex:currentView withSubviewAtIndex:nextView];
//Doesn't work because curentView is not global... with each instance of a class it's reset to what it's instanciated to.
//currentView++;
// Commit Animation Block
[UIView commitAnimations];
这个动画代码工作正常两种观点。但我试图为很多观点做到这一点。我尝试通过添加一个全局变量(nextview index和currentView index),但是这不起作用,因为每个自定义视图类都有它自己的实例,并且这些变量不被共享。
有谁知道我该如何完成我想要做的事情?
谢谢!
编辑:我可以做到这一点,如果我可以使用[self superview]来访问currentview和nextview的索引。有没有一些方法可以做到这一点?
我有意见的数组,我创建appdelegate和我添加一个不同的数组到每个标签视图控制器。然后控制器使用该数组创建动画uiviews以在它们之间切换。我在动画切换时遇到了问题... – rksprst 2008-10-26 21:45:14