在iOS程序中检测数字和链接

在程序中检测数字和链接

在iPhone 3.0后就支持UIDataDetectorTypes来检测数字和链接。

UIDataDetectorTypePhoneNumber

UIDataDetectorTypeLink

UIDataDetectorTypeNone

UIDataDetectorTypeAll

通过设置dataDetectorTypes属性就可以实现功能

- (void)viewDidLoad {

- self.textView.dataDetectorTypes = UIDataDetectorTypeAll;

- }

clip_p_w_picpath002

同时你也可以通过Interface Builder来设置属性。

clip_p_w_picpath004

 

参考:

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章