I am using UIWebView to display an HTML page inside an IOS app. The HTML page contains a png file that I create on the local disk and write to. Everything works fine the first time I display the page, but when I try to create a new image and redisplay the page, the original image is displayed.

The issue appears to be that I am using the same file name for the PNG file. Even though I write to the PNG file with a new image, the UIWebView is caching the image from the original load, and displays the original image, not the new one. I have verified that the new image is being written to correctly by loading it into Safari.

So how can I clear the UIWebView's cache of this image? I realize that another option would be to give the png file a different file name each time I create it, but then I'd either accumulate png files or I'd have to add code to clear out the png files when done - which I'd rather not do.