I have several Core Animation's going on at the same time. They all have an context and an animation id, where the context is the object that's beeing animated (UIImageView objects). I would like to pause them, so that the animation just stops temporarily, and then when some things are done, resume it to complete it. These things happen only on very fast scroll movements in an UIScrollView. I want to improve performance by stopping all ongoing animations but not the one that makes the scroll view scroll. I have implemented an custom animation of the contentOffset for that scroll view.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
The only way I have gotten around this is the following.
For each view you wish to stop animating:
Set the view's frame to the presentation layer
Remove all animations from that view
Perform your scroll
Recalculate animations
Add new animations to the view
I know it isn't what you want to hear, but it isn't as bad as it sounds. A good way to track the views you want to stop is to give them a predetermined tag.
To remove animations:
[myView.layer removeAllAnimations]
[myView.layer removeAnimationForKey:@"theAnimationKey"]
You can pause layer animations by setting the speed of the animation to zero, see How to pause the animation of a layer tree.
To anyone who comes searching, this is how you pause and resume animations:
https://developer.apple.com/library/archive/qa/qa1673/_index.html
The Core Animation Programming Guide has a section on Customizing the Timing of an Animation which includes a section on Pausing and Resuming Animations.