3

My app uses drawViewHierarchyInRect to get a UIImage from a rather complex view. Everything has worked for years... except now that the iPhone X and new iPad Pros are out. (Late 2018 models.) On these devices this call is tremendously slower than on previous models. Am I the only one finding this?

I'm calling it on the main thread, fwiw.
-Pete

VTPete
  • 361
  • 1
  • 12
  • Related: https://stackoverflow.com/questions/33592307/what-is-expected-performance-of-drawviewhierarchyinrect-vs-renderincontext. Are you rendering the same image, or perhaps downloading higer-resolution (HDR?) assets for these newer devices? – Graham Perks Dec 04 '18 at 14:41
  • Good question. The image is always resized ahead of time to exactly match the resolution of the screen in order to reduce its size (if necessary.) The increased resolution of these devices could be the issue, but they're not *that* much larger than my previous iPad Pro 12.0 or 6S Plus, but the function takes approximately 8 times longer to execute. I've worked around it for now, but I'm surprised I haven't found anyone else with this issue. – VTPete Dec 05 '18 at 12:25
  • Why you can't use `snapshotViewAfterScreenUpdates ` and friends instead? See https://stackoverflow.com/a/43192738/506566 for details. It IS slower partly because you likely use old `UIGraphicsBeginImageContext` api instead of ImageRenderer. – wonder.mice Jan 10 '19 at 05:33
  • What is the workaround you used? I am facing the same thing. – edhnb Jan 10 '19 at 23:17
  • My workaround was to remove some functionality rather than fix the problem. Wonder.mice, in both this thread and the one you linked to you mention snapshotViewAfterScreenUpdates and "friends". Can you clarify how this works for us? I can't make heads or tails out of the docs and don't know what you mean by "friends". – VTPete Jan 11 '19 at 10:39

0 Answers0