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, 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];
}
---------------------------------------------------------------------------------------------------------------------------------
分享到:
相关推荐
iphoneos-arm iPhone 必备工具
iPhone开发-全校公选课考试题.doc
ios iphone开发-内存管理 所有权是iPhone内存管理的核心思想,对象的所有者负责在使用完对象后进行释放。一个对象可以有多个所有者,当它没有所有者时将被设置为取消分配(deallocation)
iphone 游戏中,实现手柄功能,代码样例
iphone 开发-一个带索引和搜索功能的tableview例子,清晰的展示了功能实现的方法,简单易懂。
NULL 博文链接:https://android-zhang.iteye.com/blog/1759395
ios方面的计算器程序,通过这个程序我们至少可以学会基于视图的应用程序开发的流程(定义输入口和操作、连接到Interface Builder、实现我们的程序逻辑等),掌握了Xcode、InterfaceBuilder和模拟器之间的配合开发。
cydia_1.0.3366-1_iphoneos-arm-安装包-图标不见了
iPhone6-4.7英寸-pcb设计图,
知易Cocos2D-iPhone开发教程-08知易Cocos2D-iPhone开发教程-08
安卓app开发项目-我也模仿了Path效果,效果更接近iphone(源码).zip安卓app开发项目-我也模仿了Path效果,效果更接近iphone(源码).zip安卓app开发项目-我也模仿了Path效果,效果更接近iphone(源码).zip安卓app开发...
iphone开发 动画类库 源代码 直接导入程序使用 旋转 翻滚 渐变
iPhone开发秘籍---第二版
①-iphone应用程序开发-iPhoneAppProgrammingGuide|iphone开发
iphone开发过程中控件的使用方法的源代码 包括了所有控件
iPhone笔记-Object-c基础总结
iPhoneSDK--源码+书 iPhone .net开发学习资料
iphone开发中,导航和tabbar的结合使用,代码样例。
mobilesubstrate_0.9.3999.1_iphoneos-arm
iOS开发------程序实现国际化Localizable - iPhone手机开发技术文章 - 红黑联盟1