UIWebView: monitor screen updates (dirty regions)

I am trying to detect animations and other screen updates as they happen in UIWebView. I would like to get the rectangles of the areas in the UIWebView that have been changed since the last update.

I think that really what I'm looking for is a way to “capture” the calls that the UIWebView makes for setNeedsDisplayInRect. Is there any way to do this? Can I somehow subclass the UIWebView underlying the CALayer so that I can catch these calls when they come in from the UIWebView?

+3
source share
2 answers

There is no good way to do this. You can try to capture a UIWebView CALayer snapshot and compare it with the previous snapshot, but it was very difficult for me to get reliable UIWebViews snapshots.

0
source

Use the Objective-C category (@implementation CALayer (MyCalayer)), as you already do, based on your update, to catch calls coming from UIWebView to CALayer.

Then use the Swizzling Method to reassign the category override to the original CALayer object.

0
source

All Articles