在程序中检测数字和链接
在iPhone 3.0后就支持UIDataDetectorTypes来检测数字和链接。
UIDataDetectorTypePhoneNumber
UIDataDetectorTypeLink
UIDataDetectorTypeNone
UIDataDetectorTypeAll
通过设置dataDetectorTypes属性就可以实现功能
- (void)viewDidLoad {
- self.textView.dataDetectorTypes = UIDataDetectorTypeAll;
- }
同时你也可以通过Interface Builder来设置属性。
参考:
https://developer.apple.com/devcenter/ios/index.action
本文介绍如何在iOS应用中利用UIDataDetectorTypes功能检测数字和链接,包括设置dataDetectorTypes属性和通过InterfaceBuilder进行配置。提供了一个简单的实现示例。



被折叠的 条评论
为什么被折叠?



