2011-09-02 58 views
0

我需要一個背景圖片添加到我加載到一個UIWebView我怎樣才能在html代碼中插入圖像?

NSString *stringToReplace = [NSString stringWithFormat:@"<a style=\"color:white; background-color:#707070; text-decoration:none\" href=\"compose://%@\">%@</a>",substring,substring]; 
    newString = [newString stringByReplacingOccurrencesOfString:substring withString:stringToReplace]; 

我已經成功地改變背景顏色都包含在一個HTML代碼中的電話號碼,而是我需要把圖像作爲背景。 主要目標是在電話號碼後面製作帶有圓角的lightGray背景。

我發現是什麼問題 solution

感謝,

+0

http://www.google .hu/search?q = html + background + image –

回答

0

我真的不undderstand你的代碼,也許你應該使用css background images

background: #afdafd url('path...'); 
      /*def.color. back.img.*/ 

<a style=\"color:white; background:#707070 url('/images/rounded-corner.png'); text-decoration:none\" href=\"compose://%@\">%@</a> 
+0

我試圖添加一個像這樣的圖像,但它不加載。我應該爲我的圖片指定什麼路徑? – George

+0

我只看到灰色背景,沒有圖像 – George

+0

指向圖像的路徑。嘗試在瀏覽器中打開圖像並使用地址欄中的路徑。 –