iOSAnimationSample icon indicating copy to clipboard operation
iOSAnimationSample copied to clipboard

UIView.animate是在View层的动画吗?它和CoreAnimation这个Layer层的相比是不是效率会低呢?

Open XuanZheJiang opened this issue 9 years ago • 4 comments

看了老师的视频很受启发。期待老师的后续大作。今日提问望解答,虽说是个基础问题。谢谢!

XuanZheJiang avatar Oct 20 '16 01:10 XuanZheJiang

谢谢你的支持。UIView 的动画底层还是使用了 Core Animation 的 APIs,执行效率会低一点,但是 UIView 动画的 API 更加简便,所以我推荐可以使用 UIView 动画的先使用它,如何不行再使用 Core Animation 的动画。 请看一下 iOS 10 最新的 API https://developer.apple.com/reference/uikit/uiviewpropertyanimator 我也做了个简单的例子叫做 SaveTheDot https://github.com/JakeLin/SaveTheDot.

在 render 方面, UIView 确实比 CALayer 要慢,因为他包括 CALayer,而且要处理事件。有些库未来加快 render, 把 UI 元素在 background 线程合并处理成 layer,然后再 render,这样比在直接使用多层的 UIView 要快。

谢谢 Jake

On 20 October 2016 at 12:34, 蒋轩哲 [email protected] wrote:

看来老师的视频很受启发。期待老师的后续大作。今日提问望解答,虽说是个基础问题。谢谢!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JakeLin/iOSAnimationSample/issues/3, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjBoK6yj98aClixgrV78m_4bcLruOZkks5q1sU2gaJpZM4Kboc5 .

JakeLin avatar Oct 20 '16 05:10 JakeLin

多谢老师指点!在做Login页面那集提到将很多View放在了屏幕左边。但是我的DEMO在push出Login页面的瞬间,可以清楚的看到放在屏幕左边的控件。这个是正常而不可避免的吗?多谢老师!

XuanZheJiang avatar Oct 20 '16 05:10 XuanZheJiang

不好意思,这个细节我记不清楚了,你可以截个图看看吗?而且当时为了简化,没有讲述 Auto Layout 等内容,在 github 的 project 都做上了。

2016-10-20 16:45 GMT+11:00 蒋轩哲 [email protected]:

多谢老师指点!在做Login页面那集提到将很多View放在了屏幕左边。但是我的DEMO在push出Login页面的瞬间, 可以清楚的看到放在屏幕左边的控件。这个是正常而不可避免的吗?多谢老师!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JakeLin/iOSAnimationSample/issues/3#issuecomment-255014423, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjBoI1nScNkHb9mTuSqkaTjKtrkKqc9ks5q1v_egaJpZM4Kboc5 .

JakeLin avatar Oct 20 '16 05:10 JakeLin

给您发了一封gmail邮件。包含了问题重现的视频。请您接收。谢谢!

XuanZheJiang avatar Oct 20 '16 06:10 XuanZheJiang