Xuan Zi Xuan Zi - 1 year ago 127
Swift Question

iOS swift alarm repeat function table

I am new in swift and I trying to do the function similar with the iOS default add alarm function "Repeat":

The "repeat" cell

When Saturday and Sunday select it will show "Weekends":

Saturday and Sunday Selected

Else if only select Monday to Friday it will show "Weekdays"

else if only select certain day example "Monday Tuesday" it will show on the label is "Mon Tue"

if select everyday, so the label will show everyday on the label

Now I only done do on table cell with multiple selection but dont know how to get the value from the selected selection on previous table and display on the label

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

I try my best ask my question very very clearly. Please give some suggestion instead down my post.

Answer Source

You need to maintain elsewhere in your code the state of all the days (an array of 7 booleans, for instance). In didSelect... and didDeselect..., you can then update the array, and know the state of all the days.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download