简体   繁体   English

我可以同时使用Threading进行拖动和UIButton事件吗?

[英]Can I use Threading for dragging and UIButton event simultaneously?

I am having a customize user interface for my iPad Application, and There is a dragging of an Object and button event simultaneously. 我的iPad应用程序具有自定义用户界面,并且同时拖动对象和按钮事件。 My Problem is that when i drag the object the animation start working and when i leave the object the animation still working for few time. 我的问题是,当我拖动对象时,动画开始工作,而当我离开对象时,动画仍在工作一段时间。 In the mean time while i am trying to press button or dragging another object, its not working till the animation completes. 同时,当我尝试按下按钮或拖动另一个对象时,它直到动画完成才起作用。

If you want to interact with the UIButton that's animating: 如果要与正在动画的UIButton交互:
Using (core) animation; 使用(核心)动画; you can't interact with the elements during their animation cycle (the regular way). 您不能在元素的动画周期内(常规方式)与它们进行交互。 Only when the animation is finished you can interact with them again. 只有完成动画后,您才能再次与他们互动。 You can make your own touch handlers on the main view which checks if the touch is 'nearby' the animated button. 您可以在主视图上创建自己的触摸处理程序,以检查触摸是否位于动画按钮的“附近”。

If you want to interact with the 'rest': 如果您想与“休息”互动:
Make sure you animate your object using the UIViewAnimationOptionAllowUserInteraction parameter: 确保使用UIViewAnimationOptionAllowUserInteraction参数为对象设置动画:

During an animation, user interactions are temporarily disabled for the views being animated. (Prior to iOS 5, user interactions are disabled for the entire application.) If you want users to be able to interact with the views, include the UIViewAnimationOptionAllowUserInteraction constant in the options parameter.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM