title: iOS WebView remote html with local image files
body: <p>Similar questions have been asked before, but I could never find a solution.</p>
  
  <p>Here is my situation - my UIWebView loads a remote html page. The images used in the web pages are known at build time. In order to make the page load faster, I want to package the image files in the iOS application and substitue them at runtime.</p>
  
  <p>[Please note that the html is remote. I always get answers for loading both html and image files from local - I have done that already]</p>
  
  <p>The closest recommendation I got was to use a custom url scheme such as myapp://images/img.png in the html page and in the iOS application, intercept the myapp:// URL with NSURLProtocol subclass and replace the image with a local image. Sounded good in theory, but I haven't come across a complete code example demonstrating this.</p>
  
  <p>I have Java background. I could do this easily for Android using a Custom Content Provider. I am sure a similar solution must exist for iOS/Objective-C. I don't have enough experience in Objective-C to solve it myself in the short timeframe I have.</p>
  
  <p>Any help will be appreciated.</p>