在//西雅图下的ThirdArray中,我想制作一个名单和数字列表。我该怎么办?
如何突出显示电话号码,以便当用户触摸时,会拨打电话号码?
谢谢,这是我的第一语言
import UIKit
class FirstTableViewController: UITableViewController{
var FirstTableArray = [String]()
var SecondArray = [SecondTable]()
var ThirdArray = [ThirdView]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
FirstTableArray = ["Washington", "California", "Alaska","About Us"]
SecondArray =
[SecondTable(SecondTitle: ["Seatle","Spokane","Tacoma"]),
SecondTable(SecondTitle: ["Los Angeles","San Diego","Sanjose"]),
SecondTable(SecondTitle: ["Anchorage"]),
SecondTable(SecondTitle: [">"])]
ThirdArray =
[ThirdView(ThirdViewArray:
//Seattle
["Joe: 222-222-2222",
//Spokane
"Lars- 333-333-3333",
//Tacoma
"Oien- 444-444-4444"]),
答案 0 :(得分:1)
我首先建议您将数据放入字典中,您可以这样声明:
var ThirdDictionary: <String, Int> = ["Joe": 2222222222, "Lars": 3333333333, "Oien": 4444444444]
然后您可以填充UITextField,例如通过将数据从字典中导入UITextView,如下所示:
for (name, number) in ThirdDictionary {
myTextView.text = "\(number)"
}
最后,UITextView有一个dataDetectorTypes属性,您可以设置该属性以使其成为可点击的电话号码:
myTextView.dataDetectorTypes = UIDataDetectorTypes.PhoneNumber