3

I'm trying to lazy load UIWebViews inside a UIScrollView. Every time the user scrolls, the WebViews frames are updated and new content SHOULD be loaded. And that's exactly where I'm having trouble. The repositioning works well, but the new content (local NSStrings, which are called using loadHTMLString) does not appear until I stop scrolling the ScrollView.

I've read this thread already: NSURLRequest won't fire while UIScrollView is scrolling.

Getting some inspiration from that, is there any association I could make between loadHTMLString and NSURLConnection? I know next to nothing about NSURLConnection.

If that's not possible, is there any other solution? Either halting the scroll for a while (like MobileRSS – an App Store app – does) or alternate loading methods?

Edit: My UIScrollView has paging enabled. So if I were to halt the scroll for a while, it should happen at every page. But I still don't know how to accomplish that.

Community
  • 1
  • 1
Aloha Silver
  • 1,394
  • 17
  • 35

1 Answers1

0

Old question, but here is an answer for it.

You'll have to subclass the UIWebView and switch the run loops started at a overridden loadHTMLString:baseURL: and switching it back after the html has been loaded (or failed to load).

Check out this project on github which gives you an example of where to override in all the right places.

MweyaMutsvene
  • 543
  • 4
  • 15