How to refer a local image file from UIWebView's HTML on iPhone?

后端 未结 4 590
面向向阳花
面向向阳花 2021-01-21 16:16

I would like to use temp.jpg\" /> in my UIWebView\'s HTML.
How can I refer to a local file named

4条回答
  •  旧时难觅i
    2021-01-21 17:14

    This will create a URL object that contains the location of your file on disk. You can then use this to output a valid file:// URL string that can be used within img tags.

    NSURL* fileURL = [[NSBundle mainBundle] URLForResource:@"temp" withExtension:@"jpg"];
    
    NSLog(@"", fileURL.absoluteString);
    

提交回复
热议问题