Boris-Em/BEMCheckBox

Not able to group checkbox groups

upendrasiripurapu opened this issue · 4 comments

Hi,
First of all thanks for this awesome library. I am using this in my application where I have to use it like Checkbox in some cases and radio buttons in some cases. Here when I am trying to group checkboxes that are created in for loop it is not working. Here is my code.

int xVal = 10;
            NSMutableArray *checkBoxArray = [[NSMutableArray alloc] init];
            for (int i=0; i<3; i++) {
                BEMCheckBox *myCheckBox = [[BEMCheckBox alloc] initWithFrame:CGRectMake(xVal, 0, 50, 50)];
                myCheckBox.tag = 100+i;
                myCheckBox.delegate = self;
                [cell addSubview:myCheckBox];
                [checkBoxArray addObject:myCheckBox];
                xVal += 60;
            }
            BEMCheckBoxGroup *boxGroup = [BEMCheckBoxGroup groupWithCheckBoxes:checkBoxArray];
            boxGroup.selectedCheckBox = checkBoxArray[0];
            boxGroup.mustHaveSelection = YES;

Please let me know if this implementation is wrong.

Thanks for the kind words @upendrasiripurapu!
What precisely isn't working for you?
Your implementation looks fine to me.

When I am adding myCheckBox to BEMCheckBoxGroup then it should work like radio buttons right, like anytime only one button should be selected and others should be deselected. But here it is now working like that.

Regards

This is indeed a bug on our side of things. Good catch! I submitted a PR (#55) that should fix the issue. Feel free to review it =)

This is fixed with the release of 1.4.1. Thank you for your contribution @upendrasiripurapu!