首页 > 解决方案 > 快速在地图上的uitextview中使电话号码可点击

问题描述

我想使用 datadetector 在 MapView 上的 UITextView 中制作电话号码,但它不起作用。

有问题的 textView 是通用 UIView 的子视图,它是 Map 上 MKAnnotationView 的子视图,因此子视图层次结构中的某些东西可能导致问题。

下面是配置 textView 的代码:

textView.font = UIFont.systemFont(ofSize: 14)
textView.isUserInteractionEnabled = true
textView.isSelectable = true
textView.isEditable = false
textView.dataDetectorTypes = UIDataDetectorTypes.all
//mycustomview is a plain rectangular uiview
myCustomView.addSubview(textView)
//annotationview is an MKAnnotationView
 annotationView.addSubview(myCustomView)

在此先感谢您的任何建议

标签: iosswiftmkannotationviewdatadetectortypes

解决方案


推荐阅读