UIKit Dynamics的中文名称:有叫UIKit动力,也有叫UIKit动力模型和UIKit动态或者动态UI,叫什么名不要紧,理解就含义就可以了。

什么是UIKit Dynamics ?

UIKit动力提供了一个模拟真实世界中力学相关的动画和交互系统。比如重力、碰撞和吸附等。UIKit动力具有可组合、可重用和声明式的特点。我的理解就是把游戏开发中的物理引擎的搬过来了。

首先简单看几点基础知识:

1、UIDynamicAnimator:

a、

A dynamic animator provides physics-related capabilities and animations for its dynamic items, and providesthe context for those animations. It does this by intermediating between the underlying iOS physics engineand dynamic items, via behavior objects you add to the animator.

UIDynamicAnimator类的作用是起到衔接动力项和view,很重要。

b、

可以有这些作用:(当然,英文不用都理解,明白大致意思就可以,后面看代码就明白了)

All types of dynamic animators share the following characteristics:

Each dynamic animator is independent of other dynamic animators you create

You can associate a given dynamic item with multiple behaviors, provided those behaviors belong to thesame animator

An animator automatically pauses when all its items are at rest, and automatically resumes when a behaviorparameter changes or a behavior or item is added or removed

c、

初始化方法:

– initWithReferenceView:
Initializes a dynamic animator with a specified view as its reference view.

初始化方法里关联view!

d、

UIDynamicAnimator在view中实现的时候,也有其代理方法:

dynamicAnimatorDidPause:   动力项在view中被Pause的时候时候回调此方法

dynamicAnimatorWillResume:  动力项在view中Resume的时候时候回调此方法

2、一些动力项(都是模拟真实物体在现实中的行为)

UIAttachmentBehavior       吸附
UICollisionBehavior            碰撞
UIDynamicItemBehavior    活力(类似真实物体,有活力,更逼真)
UIGravityBehavior              重力(物体受重力影响自由下落)
UIPushBehavior                 推动
UISnapBehavior objects    仓促

下看就去看代码吧:官网demo(http://pan.baidu.com/share/link?shareid=1092885049&uk=3674861929

UIDynamicAnimator_Class 文档下载直通车:http://pan.baidu.com/share/link?shareid=1108425560&uk=3674861929

更多内容请查看官网:https://developer.apple.com/wwdc/schedule/

这个爱学习的人的博客也很有用:http://www.cocoachina.com/newbie/basic/2013/0612/6393.html

注意:

1、如果看代码,或者自己建立项目的时候,出现IOS7的build错误了,那就看看这里吧 http://blog.csdn.net/zfpp25_/article/details/9106573

2、看代码时,会遇到 anchorPoint (锚点)这个游戏中常用的概念,不明白不要紧,看这里 http://blog.csdn.net/zfpp25_/article/details/8641651

虽然官网的例子也有问题,不过新东西,代码太少,将就看吧,由于工作忙,所以没那么多空闲时间,就到这里吧。祝学习快乐。

最新文章

  1. 【Java EE 学习 78 下】【数据采集系统第十天】【数据采集系统完成】
  2. Android之AnimationDrawable初识
  3. .Net Ioc Unity
  4. python_way ,day5 模块,模块3 ,双层装饰器,字符串格式化,生成器,递归,模块倒入,第三方模块倒入,序列化反序列化,日志处理
  5. java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
  6. java中动态代理
  7. (总结)工作中常用的js自定义函数——日期时间类
  8. Feedly使用技巧
  9. poj3294 --Life Forms
  10. Java Date API demo
  11. PHP 引用是个坑,请慎用
  12. DSAPI+DS控件库 Windows7风格控件演示
  13. PHP分帧后台模板页面css样式,js引入方法
  14. requests_html 使用
  15. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.autumn.book/com.autumn.book.MainActivity}: android.os.NetworkOnMainThreadException
  16. [笔记] FMX 在 iOS 平台主窗体 DoubleTap 手势,要慎用!
  17. 20155301 滕树晨linux基础——linux进程间通信(IPC)机制总结
  18. 【转】Android开发:shape和selector和layer-list的(详细说明)
  19. Ubuntu下FileZilla的安装
  20. paramiko连接远程主机,上传下载文件

热门文章

  1. luogu3195 [HNOI2008]玩具装箱TOY
  2. Install ADDS on Windows Server 2012 R2 with PowerShell
  3. 二叉树遍历(Java实现)
  4. AutoMapper教程
  5. 基于单层决策树的AdaBoost算法源码
  6. java之ArrayList.add
  7. Android之Bitmap 高效加载
  8. HLG 1494网络 (求的割点数目)可做模板
  9. html5中checkbox的选中状态的设置与获取
  10. Codeforces Round #323 (Div. 2) B 贪心,暴力