CardViewController.swift
3.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// CardViewController.swift
// Twear
//
// Created by yangbin on 2022/1/19.
//
import UIKit
class CardViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
private let cardArray: [String] = ["微信", "QQ", "Facebook", "WhatsApp", "Twitter"]
private let cardDic: [String: String] = ["微信": "push_wechat", "QQ": "push_qq", "Facebook": "push_Facebook", "WhatsApp": "push_WhatsApp", "Twitter": "push_Twitter"]
lazy var footerView: UIView = {
let view = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 45))
let label = UILabel(frame: CGRect(x: 12.5, y: 2.5, width: SCREEN_WIDTH-30, height: 40))
label.font = RegularFont(11)
label.textColor = UIColor.rgbColorFromHex(0x808080)
label.numberOfLines = 0
label.text = LocString("将名片绑定至您的手表里,随时随地添加新朋友")
view.addSubview(label)
return view
}()
override func viewDidLoad() {
super.viewDidLoad()
title = LocString("名片")
tableView.register(UINib.init(nibName: "SettingCell3", bundle: Bundle.main), forCellReuseIdentifier: "SettingCell3")
tableView.contentInset = UIEdgeInsets(top: 5, left: 0, bottom: 10, right: 0)
tableView.tableFooterView = footerView
// Do any additional setup after loading the view.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
extension CardViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 50
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cardArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingCell3", for: indexPath) as! SettingCell3
let cardText = cardArray[indexPath.row]
cell.titleLabel.text = LocString(cardText)
cell.setImageView.image = UIImage(named: cardDic[cardText]!)
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! SettingCell3
cell.isSelected = false
// let device = CurDevice
// switch cardArray[indexPath.row] {
// case "QQ":
let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "CardDetailVC") as! CardDetailVC
vc.app = cardArray[indexPath.row]
navigationController?.pushViewController(vc, animated: true)
// case "短信提醒":
// let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "SMSRemindVC")
// navigationController?.pushViewController(vc, animated: true)
// case "应用提醒":
// let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "APPRemindVC")
// navigationController?.pushViewController(vc, animated: true)
// case "健康提醒":
// let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "HealthRemindVC")
// navigationController?.pushViewController(vc, animated: true)
// case "闹钟提醒":
// let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "AlarmClockVC")
// navigationController?.pushViewController(vc, animated: true)
// default:
// break
// }
}
}