UISwitch Archives

How to test the state of a UISwitch

We can use the isOn property of your switch to do this: if (flickSwitch isOn) { statusLabel.text = @”The Switch is ON”; } else { statusLabel.text = @”The Switch is OFF”; } Alternatively we can use the square-bracket notation like so: if ([flickSwitch.isOn]) { statusLabel.text = @”The Switch is ON”; } else { statusLabel.text = […]