简体   繁体   中英

iPhone - UIView Animation on UIButton - button unclickable for portion of duration

I am trying to have a button move around the screen and still be clickable. I have it moving around the screen correctly, but the odd thing is that I can't click the button until the final second of the animation. The button is still moving and yet after a certain threshold I can click it. Any idea what is happening? Any idea for some other way I can do what I want? Thanks for any help.

I believe the button is moved to the final animation position when the animation starts , however it is not displayed there until the animation is done. While moving you only see a projection of the image of it, not really the actual button. I think if you could periodically log the frame value of the button during the animation you could see this (hmmm, I'll have to try that in my color picker).

Perhaps you can move the button a little at a time in many animations instead of one long move?

EDIT: I tried this in a program I'm working on, logged the origin for an object being animated. It has the final origin value throughout the animation:

2010-05-04 20:41:08.914 beginAnimations: origin=175 197
2010-05-04 20:41:08.915 commitAnimations: origin= 79 333
2010-05-04 20:41:08.964 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.064 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.164 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.264 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.364 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.464 -[ColorPickerVC showSlidingColorOrigin:]  79 333
2010-05-04 20:41:09.577 annimationDone: origin= 79 333

Without any detailed information, I can only assume certain aspects of the problem. My assumption is that you've created a dynamic UIButton and set it to the view, which is completely clickable when it's not moving on the screen. However, when you animate the button as a UIView, the button is no longer clickable. From my understanding, this is not possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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