在程序中检测数字和链接
在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