HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iPhone开发--渐隐渐显动画效果大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

1、最简单,最实用,最常用的[移动动画]//移动一个view---------------------------------------------------------------------------------------------------------------------------------+(void)MoveView:(UIView *)view To:(CGRect)frame During:(float)time{// 动画开始[UIView beginAnimations:nil context:nil];// 动画时间曲线 EaseInOut效果[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; // 动画时间[UIView setAnimationDuration:time];view.frame = frame;// 动画结束(或者用提交也不错)[UIView commitAnimations];}---------------------------------------------------------------------------------------------------------------------------------适用范围:常常出现在ipad项目中,当用户点击一个图片,或者一条资讯,你将弹出一个详细页面[detailview],将起始frame初始化为 cgrectmake(self.view.frame.size.width/2,self.view.size.height/2,0),结束位置[frame],常用的动画间隔时间0.4f-0.6f。[AnimtionTool MoveView:detailview To:frame During:0.5f];效果页面中间将从小到大显示一个view[detailview]2、渐渐显示一个view,需要在调用方法的类中重写此方法---------------------------------------------------------------------------------------------------------------------------------/*- (void)onAnimationComplete:(NSString *)animationID finished:(NSnumber *)finished context:(void *)context {      if ([animationID isEqualToString: SHOW_VIEW]) {         //do something      }  else if ([animationID isEqualToString:HIDDEN_VIEW]) {         //do something      }}*/+(void)ShowView:(UIView *)view To:(CGRect)frame During:(float)time delegate:(id)delegate;{[UIView beginAnimations:SHOW_VIEW context:nil];[UIView setAnimationDuration:time];[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; if(delegate !=nil &&[delegate respondsToSELEctor:@SELEctor(onAnimationComplete:finished:context:)]){[UIView setAnimationDidStopSELEctor:@SELEctor(onAnimationComplete:finished:context:)];[UIView setAnimationDelegate:delegate];}view.hidden = NO;view.layer.opacity = 1.0;view.frame = frame;[UIView commitAnimations];}---------------------------------------------------------------------------------------------------------------------------------3、渐渐隐藏一个view---------------------------------------------------------------------------------------------------------------------------------+(void)HiddenView:(UIView *)view To:(CGRect)frame During:(float)time delegate:(id)delegate{[UIView beginAnimations:HIDDEN_VIEW context:nil];[UIView setAnimationDuration:time];[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; if(delegate !=nil &&[delegate respondsToSELEctor:@SELEctor(onAnimationComplete:finished:context:)]){[UIView setAnimationDidStopSELEctor:@SELEctor(onAnimationComplete:finished:context:)];[UIView setAnimationDelegate:delegate];}view.frame = frame;view.layer.opacity = 0.0;[UIView commitAnimations];}---------------------------------------------------------------------------------------------------------------------------------

大佬总结

以上是大佬教程为你收集整理的iPhone开发--渐隐渐显动画效果全部内容,希望文章能够帮你解决iPhone开发--渐隐渐显动画效果所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。