Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIView动画期间观察的键值_Iphone_Objective C_Cocoa_Cocoa Touch_Notifications - Fatal编程技术网

Iphone UIView动画期间观察的键值

Iphone UIView动画期间观察的键值,iphone,objective-c,cocoa,cocoa-touch,notifications,Iphone,Objective C,Cocoa,Cocoa Touch,Notifications,我正在为程序中视图的“中心”属性设置动画。在动画期间,我需要在“中心”命中特定值时发出通知 我尝试将我自己添加为视图中心属性的键值观察者。但是,我只在动画开始时收到通知。因此,我无法检测物体是否/何时通过我的兴趣点 有没有办法通过KVO或任何其他方法来实现这一点 谢谢 通过访问UIView的表示层,可以检索表示UIView动画层当前状态的值。这可以使用如下代码完成: CGPoint currentCenter = [[view.layer presentationLayer] center];

我正在为程序中视图的“中心”属性设置动画。在动画期间,我需要在“中心”命中特定值时发出通知

我尝试将我自己添加为视图中心属性的键值观察者。但是,我只在动画开始时收到通知。因此,我无法检测物体是否/何时通过我的兴趣点

有没有办法通过KVO或任何其他方法来实现这一点


谢谢

通过访问UIView的表示层,可以检索表示UIView动画层当前状态的值。这可以使用如下代码完成:

CGPoint currentCenter = [[view.layer presentationLayer] center];

不幸的是,表示层的属性不符合KVO,因此我能想到的跟踪当前值的最佳方法是不断轮询表示层,直到它接近您想要的位置。

谢谢您让我知道!我将尝试找出如何在代码中手动观察属性。