When I select the check box the second time it shows me the checked image, but the status is unchecked.
Here is my code:
- (void)viewDidLoad {
    [super viewDidLoad];
    [CheckBox setBackgroundImage:[UIImage imageNamed:@"uncheck_checkbox.png"] forState:UIControlStateNormal];
}
- (IBAction)CheckBox:(id)sender {
    if (CheckBox.selected == NO)
    {
          CheckBox.selected = YES;
          [CheckBox setBackgroundImage:[UIImage imageNamed:@"checked_checkbox.png"] forState:UIControlStateNormal];       
    }
    else
    {
          CheckBox.selected = NO;
          [CheckBox setBackgroundImage:[UIImage imageNamed:@"uncheck_checkbox.png"] forState:UIControlStateSelected];     
    }
}
                Your code is totally right just you replace UIControlStateSelected to UIControlStateNormal.
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