gpt4 book ai didi

IOS - UIWebView 中不需要的超链接

转载 作者:行者123 更新时间:2023-11-29 04:02:31 25 4
gpt4 key购买 nike

得到了我作为字符串插入到 uiwebview 的 html

<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”上有一个蓝色超链接

有人知道为什么以及如何禁用此行为吗?

谢谢

最佳答案

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;

关于IOS - UIWebView 中不需要的超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15688707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com