uiwebview 禁止数字链接问题(UIDataDetectorTypeNone)

来源:互联网 发布:python爬虫项目 知乎 编辑:程序博客网 时间:2024/05/22 16:00

今天帮助同事解决了一个bug  ,问题是webview  传过来的数字会有链接,后来查询后,

可以用UIDataDetectorTypeNone 来禁止检测 数字链接问题

   m_webView.dataDetectorTypes =UIDataDetectorTypeNone;


下面是来自网络博客对这个函数的说明

在iOS程序中检测数字和链接[转]

在程序中检测数字和链接

在iPhone 3.0后就支持UIDataDetectorTypes来检测数字和链接。

UIDataDetectorTypePhoneNumber

UIDataDetectorTypeLink

UIDataDetectorTypeNone

UIDataDetectorTypeAll

通过设置dataDetectorTypes属性就可以实现功能

- (void)viewDidLoad {

- self.textView.dataDetectorTypes = UIDataDetectorTypeAll;

- }

clip_image002

同时你也可以通过Interface Builder来设置属性。

clip_image004


参考:


https://developer.apple.com/devcenter/ios/index.action


转自:http://blog.csdn.net/arthurchenjs/article/details/7336280



0 0