在iOS程序中檢測數字和連接

在程序中檢測數字和連接ios

在iPhone 3.0後就支持UIDataDetectorTypes來檢測數字和連接。app

UIDataDetectorTypePhoneNumberide

UIDataDetectorTypeLinkui

UIDataDetectorTypeNone3d

UIDataDetectorTypeAllblog

經過設置dataDetectorTypes屬性就能夠實現功能ip

- (void)viewDidLoad {get

- self.textView.dataDetectorTypes = UIDataDetectorTypeAll;it

- }io

clip_p_w_picpath002

同時你也能夠經過Interface Builder來設置屬性。

clip_p_w_picpath004

 

參考:

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

相關文章
相關標籤/搜索