objective c - How to Load image in uiwebview? -
i doing following steps display html file in uiwebview.
1.unzip .epub file, html file content in array
nsdata *data=[nsdata datawithcontentsoffile:filepath];
[arraydatacontent addobject:data];
after process complete. removed unzip .epub file.
- 2.
nsdata *htmlstring=(nsdata *)[arraydatacontent objectatindex:2];
nsstring *imagepath =[[nsbundle mainbundle] resourcepath];
imagepath = [imagepath stringbyreplacingoccurrencesofstring:@"/" withstring:@"//"]; imagepath = [imagepath stringbyreplacingoccurrencesofstring:@" " withstring:@"%20"]; [webview4epub loaddata:htmlstring mimetype:@"text/html" textencodingname:@"utf-8" baseurl:[nsurl urlwithstring:[nsstring stringwithformat:@"file:/%@//",imagepath]]];
from content text loaded in webview. there relative images not shown.
Comments
Post a Comment