Here is the IBAction method linked to the UISwitch with the valueChanged event :
- (IBAction) sanitySwitch {
if (checkoption.on == YES) {
NSLog(@"SanityCheck ENABLED");
sanityCheck = YES;
} else {
NSLog(@"SanityCheck DISABLED");
sanityCheck = NO;
}
}
It always returns "SanityCheck DISABLED". The UISwitch checkoption is correcty linked to its object from the XIB file and proper @propery and @syntetize setting have been placed.
Replace the code with the this code. and connect again with switch as value change control event.
- (IBAction) sanitySwitch:(id)sender {
if ([sender isOn]) {
NSLog(@"SanityCheck ENABLED");
sanityCheck = YES;
}
else {
NSLog(@"SanityCheck DISABLED");
sanityCheck = NO;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With