Add a completion block to every UIKit method that has a `animate:` parameter
| Originator: | madoue | ||
| Number: | rdar://21386292 | Date Originated: | 15-Jun-2015 03:33 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 9 |
| Classification: | Enhancement | Reproducible: | Always |
Summary:
It's very hard to create smooth chained animations when many methods that animate views do not have a completion handler.
Steps to Reproduce:
Try to write code that calls -[UIScrollView scrollRectToVisible:rect animated:YES] and does something exactly when the scroll view finishes scrolling. You can either handle -[scrollViewDidEndScrollingAnimation:] (ugly, the code is completely disconnected from the original animation) or figure out how long the standard animation takes and do dispatch_after (even uglier, how long it takes is not documented and it _will_ change eventually, etc).
Expected Results:
[self.scrollView scrollRectToVisible:rect animated:YES completion:^() {
// do something when the animation finishes
}];
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
From Apple Developer Relations:
We will not solve this problem in such a manner. Oftentimes you can use a transition coordinator. In the case of scroll view we will keep the bug report to see if we can up with a more general solution in the next major release.
We are continuing to work on this issue, and will follow up with you again.