In Apple's WebKit framwork, a WebView that has finished loading its resources sends a webView:didFinishLoadForFrame:
message to its frameLoadDelegate
. However, this only means that resources have been loaded, not that rendering is done… How can I detect that the WebView rendering is done? Among all the delegates of WebView
, I couldn't find one that has the method I would need…
Asked
Active
Viewed 1,046 times
3

F'x
- 12,105
- 7
- 71
- 123
-
I can't imagine any computer these days that is not capable of rendering a webpage immediately. – TheAmateurProgrammer Aug 25 '12 at 11:47
-
3@theAmateurProgrammer define “immediately” and try again. When the `didFinishLoadForFrame` message is received, I observed many cases where the content was not yet rendered in the view. – F'x Aug 25 '12 at 12:15
1 Answers
3
I also expected to find everything in the delegate methods, tried using the resource load methods too, counting loads started & ended, but that wasn't reliable either. No stackoverflow answers helped me but someone on Apple's devforums pointed out what seems to be the answer.
WebView posts also notifications WebViewProgressStartedNotification, WebViewProgressEstimateChangedNotification, and most relevantly WebViewProgressFinishedNotification. In my code I observe the notification and then to be sure I call my finished method on the next runloop, ie. with [self performSelector:..withDelay:0] or dispatch_async.

Pierre Houston
- 1,631
- 20
- 33
-
Hum, I tried `WebViewProgressFinishedNotification` but it wasn't rendered yet. I had considered waiting a bit, but is it **guaranteed** that the rendering will be finished on the next runloop? – F'x Aug 26 '12 at 06:52
-
No, I never got an official word, it just appeared to work in my initial tests. My question about this is still outstanding on the devforums and I'm still hoping to get the final word on this issue. If it's not working for you then that's disappointing, and it's likely I'll see the same when I get back around to stress testing this part of my app. – Pierre Houston Aug 30 '12 at 07:07