f2cf74c7
yangbin
1.0.20(4)
|
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
|
//
// RemindViewController.swift
// Twear
//
// Created by yangbin on 2021/12/24.
//
import UIKit
class RemindViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var device = CurDevice
var user = UserInfo
private var remindArray: [String] = ["来电提醒", "短信提醒", "健康提醒", "应用提醒", "闹钟提醒"]
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let admin = AdminHelper.shared.loadLocalAdminData()
device = admin.device
user = admin.userInfo
tableView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
title = LocString("提醒功能")
tableView.register(UINib.init(nibName: "SettingCell3", bundle: Bundle.main), forCellReuseIdentifier: "SettingCell3")
tableView.tableFooterView = UIView(frame: CGRect.zero)
|
f2cf74c7
yangbin
1.0.20(4)
|
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Do any additional setup after loading the view.
}
}
extension RemindViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 5
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
|
cf12a6bb
daifengyi
feat:remind page UI
|
45
|
view.backgroundColor = UIColor.rgbColorFromHex(0xFAFAFA)
|
f2cf74c7
yangbin
1.0.20(4)
|
46
47
48
49
50
51
52
53
|
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
return 0.5
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
cf12a6bb
daifengyi
feat:remind page UI
|
54
|
return 64
|
f2cf74c7
yangbin
1.0.20(4)
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
}
func numberOfSections(in tableView: UITableView) -> Int {
return remindArray.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SettingCell3", for: indexPath) as! SettingCell3
let remindText = remindArray[indexPath.section]
cell.titleLabel.text = LocString(remindText)
|
f2cf74c7
yangbin
1.0.20(4)
|
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
switch remindText {
case "闹钟提醒":
var isOn: Bool = false
for alarmClock in user.alarmClocks {
if alarmClock.isOn {
isOn = true
}
}
cell.detailLabel.text = isOn ? LocString("已开启") : LocString("未开启")
case "来电提醒":
cell.detailLabel.text = user.push.call ? LocString("已开启") : LocString("未开启")
case "短信提醒":
cell.detailLabel.text = user.push.sms ? LocString("已开启") : LocString("未开启")
case "应用提醒":
cell.detailLabel.text = user.push.app ? LocString("已开启") : LocString("未开启")
case "健康提醒":
cell.detailLabel.text = (user.drink.isOn || user.sedentary.isOn) ? LocString("已开启") : LocString("未开启")
default:
break
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! SettingCell3
cell.isSelected = false
// let device = CurDevice
switch remindArray[indexPath.section] {
case "来电提醒":
let vc = UIStoryboard.loadViewControllerIdentifier(storyboardName: "Setting", identifier: "CallRemindVC")
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
}
}
}
|