我试图在窗口中激发一个页面卷曲过渡与UIImageView
。此代码位于我的主要init方法中:iPhone页面卷曲过渡动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationDelay:delay];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDidStopSelector:@selector(animCompleteHandler:finished:context:)];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:splashImage cache:YES];
splashImage.frame = CGRectMake(-320, 0, 10, 10);
//[splashImage removeFromSuperview];
[UIView commitAnimations];
图像动画化位置和大小,但不卷曲。如果我取消对removeFromSuperView
的评论,它会立即消失。有任何想法吗?
UPDATE:
是否更改了代码,以便它使用拉尔斯触发动画,包括动画和回调的fantasticlly简洁的方式...
[UIView animateWithDuration:1.5
delay:delay
options: UIViewAnimationTransitionCurlUp
animations:^{splashImage.alpha = 0;}
completion:^(BOOL finished){[splashImage removeFromSuperview];}
];
不幸的是,页面卷曲只是不会发生。它确实褪色。
我不确定这是否与语法有关,或者SplashImage
是我的主视图的UIWindow
对象中的UIImageView
类。也许它需要在UIView
才能创建转换。
我没有尝试过这个,但是我很好奇通过你的代码! ^做什么?这是嵌入函数的一种方式吗? – 2010-09-09 11:12:55
这些是iOS 4.0新增的块。 我鼓励你阅读块。 iOS的很棒的补充。看看这个:http://developer.apple.com/library/ios/#featuredarticles/Short_Practical_Guide_Blocks/index.html 如果我正确理解你的代码你想要做的是卷曲页面,同时移动和规模呢? – LarsJK 2010-09-09 12:19:37
移动和缩放并不重要,我只是想引发转换。正在使用该转换来测试它正在工作。我只需要将飞溅的图像卷页分离。为了触发这个过渡,我需要为视图做些事情。它会与'隐藏'工作吗?无论如何,我现在正在进行一些测试。感谢您的反馈意见。 – 2010-09-12 14:08:16