如何判断uiview是否在动画的中间? [英] how to tell if uiview is in middle of animation?

查看:111
本文介绍了如何判断uiview是否在动画的中间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法来判断uiview是否在动画的中间?当我在打开视图对象时,它正在移动我get(通知有一个animations变量):

 搜索栏应该结束编辑:< UISearchBar:0x2e6240; frame =(0 0; 320 88); text =''; autoresize = W + BM; animations = {position =< CABasicAnimation:0x6a69c40> ;; bounds =< CABasicAnimation:0x6a6d4d0> ;; }; layer =< CALayer:0x2e6e00>>当动画停止并打印uiview(animations变量现在消失)时,



 搜索栏应该结束编辑:< UISearchBar:0x2e6240; frame =(0 0; 320 88); text =''; autoresize = W + BM; layer =< CALayer:0x2e6e00>> UIView有一个图层();   http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html\"> Google Analytics(分析))。您可以发送 animationKeys 到它,它将给你一个键的数组,标识附加到图层的动画。我想如果有任何条目,动画正在运行。如果您想进一步了解,请查看 CAMediaTiming协议。它对当前动画做了一些更多的信息。


Is there any way to tell if a uiview is in the middle of an animation? When I print out the view object while it is moving i get(notice there is an "animations" variable):

search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>>

when the animation has stopped and i print the uiview("animations" variable now gone):

search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; layer = <CALayer: 0x2e6e00>>

解决方案

A UIView has a layer (CALayer). You can send animationKeys to it which will give you an array of keys which identify the animations attached to the layer. I suppose that if there are any entries, the animation(s) are running. If you want to dig even deeper have a look at the CAMediaTiming protocol which CALayer adopts. It does some more information on the current animation.

这篇关于如何判断uiview是否在动画的中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆