使用UIDataDetectorTypes自动检测电话、网址和邮箱


1.webView里如果有电话号码的话,设置这个熟悉可以点击拨打
webView.dataDetectorTypes = UIDataDetectorTypePhoneNumber;//自动检测网页上的电话号码,单击可以拨打

接下来我们来简单讲一下,使用UIDataDetectorTypes自动检测电话、网址和邮箱。我们先来看看UIDataDetectorTypes有哪些枚举值。

UIDataDetectorTypes的枚举值

typedef NS_OPTIONS(NSUInteger, UIDataDetectorTypes) {
    UIDataDetectorTypePhoneNumber   = 1 << 0,          // 检测电话
    UIDataDetectorTypeLink          = 1 << 1,          // 检测邮箱和网址    

#if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIDataDetectorTypeAddress = 1 << 2, // Street address detection UIDataDetectorTypeCalendarEvent = 1 << 3, // Event detection #endif UIDataDetectorTypeNone = 0, // No detection at all UIDataDetectorTypeAll = NSUIntegerMax // 检测电话、网址和邮箱 };
2.UIWebView有dataDetectorTypes属性,UITextView也有dataDetectorTypes属性。
具体详细:http://www.superqq.com/blog/2015/07/09
/shi-yong-uidatadetectortypeszi-dong-jian-ce-dian-hua-,-wang-zhi-he-you-xiang
/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io

转载于:https://www.cnblogs.com/MJP334414/p/5213826.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值