Skip to content

Instantly share code, notes, and snippets.

@gatesakagi
Created March 10, 2017 17:12
Show Gist options
  • Save gatesakagi/1f317aaf65a1fa10b19901b069f3d726 to your computer and use it in GitHub Desktop.
Save gatesakagi/1f317aaf65a1fa10b19901b069f3d726 to your computer and use it in GitHub Desktop.
switch sender.tag {
case 0: //switchGood
if (sender.isOn == true) {
labelGood.alpha = 1.0
if (switchFast.isOn == true) {
switchCheap.setOn(false, animated: true)
labelCheap.alpha = 0.5
} else if (switchCheap.isOn == true) {
switchFast.setOn(false, animated: true)
labelFast.alpha = 0.5
}
} else {
labelGood.alpha = 0.5
if (switchFast.isOn == true) {
switchCheap.setOn(true, animated: true)
labelCheap.alpha = 1.0
} else if (switchCheap.isOn == true) {
switchFast.setOn(true, animated: true)
labelFast.alpha = 1.0
}
}
case 1: //switchFast
if (sender.isOn == true) {
labelFast.alpha = 1.0
if (switchGood.isOn == true) {
switchCheap.setOn(false, animated: true)
labelCheap.alpha = 0.5
} else if (switchCheap.isOn == true) {
switchGood.setOn(false, animated: true)
labelGood.alpha = 0.5
}
} else {
labelFast.alpha = 0.5
if (switchGood.isOn == true) {
switchCheap.setOn(true, animated: true)
labelCheap.alpha = 1.0
} else if (switchCheap.isOn == true) {
switchGood.setOn(true, animated: true)
labelGood.alpha = 1.0
}
}
case 2: //switchCheap
if (sender.isOn == true) {
labelCheap.alpha = 1.0
if (switchGood.isOn == true) {
switchFast.setOn(false, animated: true)
labelFast.alpha = 0.5
} else if (switchFast.isOn == true) {
switchGood.setOn(false, animated: true)
labelGood.alpha = 0.5
}
} else {
labelCheap.alpha = 0.5;
if (switchGood.isOn == true) {
switchFast.setOn(true, animated: true)
labelFast.alpha = 1.0
} else if (switchFast.isOn == true) {
switchGood.setOn(true, animated: true)
labelGood.alpha = 1.0
}
}
default:
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment