2012-07-12 119 views
1

我在資源文件夾ABC中有一個圖像說明point.png。從資源中挑選圖像並加載到網絡視圖

我要顯示HTML中的圖像

NSString *myFilePath= [[NSBundle mainBundle] pathForResource:@"Point1" ofType:@"png"]; 
NSMutableString *strForWebView = [NSString stringWithFormat:@"<html>" 
              "<head><b>%@</b></head><br>" 
              "<img src= %@ height='30' width='30' />" 
              , [[play quotations] objectForKey:@"Heading"], myFilePath, ....... 

所以現在我應該怎麼做,這樣它選擇從它在Web視圖加載圖像的HTML中的路徑......

請幫助

感謝

+0

轉到此鏈接。我希望這將有助於你 的http:// [stackoverflow.com/questions/6420925/load-resources-from-relative-path-using-local-html-in-uiwebview] [1] [1]:http://stackoverflow.com/questions/6420925/load-resources-from-relative-path-using-local-html-in-uiwebview – Mary 2012-07-12 12:08:30

回答

0

你們的做法是極其重要的給予正確的baseUrl加載web視圖。

如果你需要的基礎url不是本地加載一些外部數據,考慮通過base64演示文稿顯示圖像,我給出了詳細信息如何在this答案中做到這一點。

在這個線程的OP中,如果只想顯示本地內容,您還將看到如何使用基本url。

相關問題