2013-03-28 73 views
0

不必要的超級鏈接了這個網站,我插入的字符串的UIWebViewIOS - 在UIWebView的

<div style="font-family: sans-serif;"> 

<p><p><u>George Barret</u>&nbsp;</p> 

<p>Irish, 
1728/1732-1784&nbsp;</p> 

<p><b><i>An Extensive Wooded River Landscape 
with Fishermen Hauling in their Nets in the Foreground</i></b><b>, </b></p> 

<p><b>1760s</b></p> 

<p>Oil on canvas<br><span style="font-size: 13.513513565063477px; line-height: 19.988739013671875px;">137 x 195.5 cm</span></p> 

<p>Heritage Gift, IIB Bank, 2005</p> 

<p><span>NGI.4750</span></p></p></div> 

我有一個藍色的超鏈接的「1728/1732年至1784年」

人知道爲什麼和我怎麼能禁用此行爲?

感謝

回答

1

myWebView.dataDetectorTypes = UIDataDetectorTypeNone;

這將防止任何轉換(電話號碼,鏈接,電子郵件地址)爲可點擊的鏈接您的UIWebView。屬性detectorTypes是位掩碼,你可以指定任何或所有下列值的邏輯或運算,:

enum { 
    UIDataDetectorTypePhoneNumber = 1 << 0, 
    UIDataDetectorTypeLink   = 1 << 1, 
    UIDataDetectorTypeAddress  = 1 << 2, 
    UIDataDetectorTypeCalendarEvent = 1 << 3, 
    UIDataDetectorTypeNone   = 0, 
    UIDataDetectorTypeAll   = NSUIntegerMax 
}; 

例如,打開只有電子郵件地址和電話號碼變成可點擊的鏈接,你會使用:

myWebView.dataDetectorTypes = 
    UIDataDetectorTypePhoneNumber | UIDataDetectorTypeAddress;