在ios view与view间切换的动画效果这篇文章中简单介绍了一种动画效果,下面我详细介绍一下ios中页面间跳转系统自带的动画效果。
动画效果可以参考:http://www.iphonedevwiki.net/index.php?title=UIViewAnimationState
下面先介绍第一组动画效果:
- (IBAction)doPrivateCATransition:(id)sender{
//http://www.iphonedevwiki.net/index.php?title=UIViewAnimationState
/*
Don’t be surprised if Apple rejects your app for including those effects,
and especially don’t be surprised if your app starts behaving strangely after an OS update.
*/
CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 10.5f * slider.value;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.fillMode = kCAFillModeForwards;
animation.endProgress = slider.value;
animation.removedOnCompletion = NO;
UIButton *theButton = (UIButton *)sender;
switch (theButton.tag) {
case 0:
animation.type = @"cube";//—
break;
case 1:
animation.type = @"suckEffect";//103
break;
case 2:
animation.type = @"oglFlip";//When subType is "fromLeft" or "fromRight", it’s the official one.
break;
case 3:
animation.type = @"rippleEffect";//110
break;
case 4:
animation.type = @"pageCurl";//101
break;
case 5:
animation.type = @"pageUnCurl";//102
break;
case 6:
animation.type = @"cameraIrisHollowOpen ";//107
break;
case 7:
animation.type = @"cameraIrisHollowClose ";//106
break;
default:
break;
}
[self.view.layer addAnimation:animation forKey:@"animation"];
self.lastAnimation = animation;
if(slider.value == 1)
[self.view exchangeSubviewAtIndex:1 withSubviewAtIndex:0];//Just remove, not release or dealloc
else{
for (int i = 0; i < [self.view.subviews count]; i++) {
[[self.view.subviews objectAtIndex:i] setUserInteractionEnabled:NO];
}
isHalfAnimation = YES;
}
}
以上是ios中常用的动画效果,还有一些是利用2d自己写的动画效果,关于自定义动画以后在研究。
源代码: http://easymorse-iphone.googlecode.com/svn/trunk/UIViewDemo/

296

被折叠的 条评论
为什么被折叠?



