iOS swift 闹钟重复功能 table
iOS swift alarm repeat function table
我是 swift 的新手,我正在尝试执行与 iOS 默认添加警报功能类似的功能 "Repeat":
周六和周日select时会显示"Weekends":
否则,如果仅 select 周一至周五,它将显示 "Weekdays"
否则如果只有 select 某一天的例子 "Monday Tuesday" 它会在标签上显示 "Mon Tue"
如果 select 每天,那么标签将每天显示在标签上
现在我只在具有多个 selection 的 table 单元格上执行操作,但不知道如何从上一个 selected selection 中获取值 table并显示在标签上
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// tableView.deselectRowAtIndexPath(indexPath, animated: true)
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
if cell.selected {
cell.accessoryType = .Checkmark
}
}
}
override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
cell.accessoryType = .None
}
}
我尽量把我的问题问得非常非常清楚。请给我一些建议,而不是在我的 post 下。
您需要在代码的其他地方维护所有日期的状态(例如,一个包含 7 个布尔值的数组)。
在didSelect...和didDeselect...中,您可以更新数组,并了解所有天的状态。
我是 swift 的新手,我正在尝试执行与 iOS 默认添加警报功能类似的功能 "Repeat":
周六和周日select时会显示"Weekends":
否则,如果仅 select 周一至周五,它将显示 "Weekdays"
否则如果只有 select 某一天的例子 "Monday Tuesday" 它会在标签上显示 "Mon Tue"
如果 select 每天,那么标签将每天显示在标签上
现在我只在具有多个 selection 的 table 单元格上执行操作,但不知道如何从上一个 selected selection 中获取值 table并显示在标签上
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// tableView.deselectRowAtIndexPath(indexPath, animated: true)
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
if cell.selected {
cell.accessoryType = .Checkmark
}
}
}
override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
if let cell = tableView.cellForRowAtIndexPath(indexPath) {
cell.accessoryType = .None
}
}
我尽量把我的问题问得非常非常清楚。请给我一些建议,而不是在我的 post 下。
您需要在代码的其他地方维护所有日期的状态(例如,一个包含 7 个布尔值的数组)。 在didSelect...和didDeselect...中,您可以更新数组,并了解所有天的状态。