I have this code to control two check boxes (buttons customized):
- (IBAction) setCheckBox: (id) sender{
UIImage *selected = [UIImage imageNamed:@"checkbox_checked.png"];
UIImage *notSelected = [UIImage imageNamed:@"checkbox_unchecked.png"];
if ([sender isSelected])
{
[sender setImage:notSelected forState:UIControlStateNormal];
[sender setSelected:NO];
if ([sender tag] == 10) boolOne = FALSE;
if ([sender tag] == 11) boolTwo = FALSE;
}
else
{
[sender setImage:selected forState:UIControlStateSelected];
[sender setSelected:YES];
if ([sender tag] == 10) boolOne = TRUE;
if ([sender tag] == 11) boolTwo = TRUE;
}
}
You can see that this code control two checkboxes, when I press one it become checked and when I press another time it become unchecked.
Now I want change this code in this way:
In default checkbox with tag 10 is checked and when I press it, I haven’t effects, but when I press checkbox with tag 11 it should be checked and checkbox 10 should be unchecked.
The checkbox should toggle the selection and also the bool value
you can get checkbox by tag value like I assume checkbox are instance of uibutton so
I hope you understand. Also set the images according to code.