iOS开发——动画编程Swift篇&(二)UIView转场动画
2024-08-28 08:59:32
UIView转场动画
// MARK: - UIView动画-过度动画 var redView:UIView? var blueView:UIView? // enum UIViewAnimationTransition : Int { // // case None // case FlipFromLeft // case FlipFromRight // case CurlUp // case CurlDown // } //上翻页 @IBAction func excessiveAnimationRed() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(1.0)//设置动画时间 UIView.setAnimationTransition(UIViewAnimationTransition.CurlUp, forView: self.view, cache: true) self.view.exchangeSubviewAtIndex(, withSubviewAtIndex: ) UIView.commitAnimations() } //下翻页 @IBAction func excessiveAnimationBlue() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(1.0)//设置动画时间 UIView.setAnimationTransition(UIViewAnimationTransition.CurlDown, forView: self.view, cache: true) self.view.exchangeSubviewAtIndex(, withSubviewAtIndex: ) UIView.commitAnimations() } // MARK: - UIView动画-翻转 @IBAction func flipAnimation() { UIView.beginAnimations(nil, context: nil) UIView.setAnimationDuration(1.0)//设置动画时间 UIView.setAnimationTransition(UIViewAnimationTransition.FlipFromLeft, forView: testImageView, cache: true) // UIView.setAnimationTransition(UIViewAnimationTransition.FlipFromRight, forView: testImageView, cache: true) UIView.commitAnimations() }
创建两个视图
//过度动画 添加两个视图 redView = UIView(frame: CGRectMake(, , , )) redView?.backgroundColor = UIColor.redColor() self.view.insertSubview(redView!, atIndex: ) blueView = UIView(frame: CGRectMake(, , , )) blueView?.backgroundColor = UIColor.blueColor() self.view.insertSubview(blueView!, atIndex: )
最新文章
- imx6 DDR_Stress_Test
- 黄聪:深入理解PHP Opcode缓存原理
- android104 帧动画,补间动画,属性动画
- 给iOS开发者的GCD用户手册
- ASP.NET 实现上一篇文章 下一篇文章
- python基础:各种类型的转换
- Web Worker Best Practices
- Python 锁 同步 互斥锁
- xcode 8 清除无用的打印
- Symbol Table Applications
- Java NIO ServerSocketChannel
- 20145104张家明 《Java程序设计》第7周学习总结
- 直接修改class文件内容即使是文本会导致App异常,正确方式是修改java再用生成的class替换掉原有的class
- 《快学Scala》第一章 基础
- Java的IO流各个类的使用原则
- selenium 对浏览器的操控 java
- 匈牙利游戏(codevs 1269)
- SOLID总结(未完待续)
- android中ListView的定位:使用setSelectionFromTop
- python--8、socket网络编程