UIView 实现反转效果
来源:互联网 发布:崔顺实长得像网络小胖 编辑:程序博客网 时间:2024/04/29 08:51
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton *btn = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn.backgroundColor = [UIColorredColor];
btn.frame =CGRectMake(10,90, 100, 50);
[self.viewaddSubview:btn];
[btn addTarget:selfaction:@selector(ActionFanzhuan)forControlEvents:UIControlEventTouchUpInside];
//需要翻转的视图
UIView *parentView = [[UIViewalloc] initWithFrame:CGRectMake(0,150, 320, 200)];
parentView.backgroundColor = [UIColoryellowColor];
parentView.tag =1000;
[self.viewaddSubview:parentView];
}
//需要在h头文件声明下面的动作响应函数
//在xib文件中添加一个button,其响应函数为下面的函数
//运行程序后,点击button就看到翻转效果
-(void)ActionFanzhuan{
//获取当前画图的设备上下文
CGContextRef context =UIGraphicsGetCurrentContext();
//开始准备动画
[UIViewbeginAnimations:nilcontext:context];
//设置动画曲线,翻译不准,见苹果官方文档
[UIViewsetAnimationCurve:UIViewAnimationCurveEaseInOut];
//设置动画持续时间
[UIViewsetAnimationDuration:1.0];
//因为没给viewController类添加成员变量,所以用下面方法得到viewDidLoad添加的子视图
UIView *parentView = [self.viewviewWithTag:1000];
//设置动画效果
[UIViewsetAnimationTransition: UIViewAnimationTransitionCurlDownforView:parentView cache:YES]; //从上向下
// [UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView:parentView cache:YES]; //从下向上
// [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView:parentView cache:YES]; //从左向右
// [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:parentView cache:YES];//从右向左
//设置动画委托
[UIViewsetAnimationDelegate:self];
//当动画执行结束,执行animationFinished方法
[UIViewsetAnimationDidStopSelector:@selector(animationFinished:)];
//提交动画
[UIViewcommitAnimations];
}
//动画效果执行完毕
- (void) animationFinished: (id) sender{
NSLog(@"animationFinished !");
}
- UIView 实现反转效果
- UIView翻转效果实现
- UIView翻转效果实现
- UIView实现动画效果
- UIView翻转效果实现
- UIView实现动画效果
- backface实现反转效果
- iphone--UIView翻转效果实现
- UIView的扩大,缩放,旋转,平移,反转等效果
- css3实现反转flip效果
- iphone--通过UIView实现动画效果
- IOS 实现 UIView 晃动 删除的 效果
- iOS 中用UIView来实现动画效果
- UIview的animateWithDuration实现动画的效果
- 自定义uiview 实现类似alertview的效果
- 利用UIDynamicanimation实现UIView布局弹簧效果
- UIView翻转效果实现(转)
- UIView 效果
- 进程管理
- 打Android渠道包简易脚本
- 为什么C++程序无法打开相对路径的文件?
- SVN的Status总结
- 陈怡暖:LME在中国设立核准仓库造国内各界强烈阻力
- UIView 实现反转效果
- 【Python】Python Requests快速入门
- Android 属性动画(Property Animation) 完全解析 (下)
- Deep Learning(深度学习)学习笔记(一)
- Servlet 的基本架构。
- jquery自动切换图片
- 【FFT】HDU 4609
- elk 日志分析系统Logstash+ElasticSearch+Kibana4
- 美国名校对SAT数学的成绩要求