在程序中檢測數字和連接ios
在iPhone 3.0後就支持UIDataDetectorTypes來檢測數字和連接。app
UIDataDetectorTypePhoneNumberide
UIDataDetectorTypeLinkui
UIDataDetectorTypeNone3d
UIDataDetectorTypeAllblog
經過設置dataDetectorTypes屬性就能夠實現功能ip
- (void)viewDidLoad {get
- self.textView.dataDetectorTypes = UIDataDetectorTypeAll;it
- }io
同時你也能夠經過Interface Builder來設置屬性。
參考: