Skip to content

Commit 7ca01aa

Browse files
committed
Added group documentation to README
1 parent 9edde65 commit 7ca01aa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* [Reloading](#reloading)
2626
* [Delegate] (#delegate)
2727
* [Customization](#customization)
28+
* [Group / Radio Button Functionality](#group--radio-button-functionality)
2829

2930
## Project Details
3031
Learn more about the **BEMCheckBox** project, licensing, support etc.
@@ -185,3 +186,22 @@ The possible values for `onAnimationType` and `offAnimationType`.
185186
- `BEMAnimationTypeFade`
186187
<p align="left"><img src="http://s24.postimg.org/3n1rre1cx/BEMAnimation_Type_Fade.gif"/></p>
187188

189+
### Group / Radio Button Functionality
190+
**BEMCheckBox**es can be easily grouped together to form radio button functionality. This will automatically manage the state of each checkbox in the group so that only one is selected at a time, and can optionally require that the group has a selection at all times.
191+
192+
Example group creation:
193+
```objective-c
194+
self.group = [BEMCheckBoxGroup groupWithCheckBoxes:@[self.checkBox1, self.checkBox2, self.checkBox3]];
195+
self.group.selectedCheckBox = self.checkBox2; // Optionally set which checkbox is pre-selected
196+
self.group.mustHaveSelection = YES; // Define if the group must always have a selection
197+
```
198+
199+
To see which checkbox is selected in that group, just ask for it:
200+
```objective-c
201+
BEMCheckBox *selection = self.group.selectedCheckBox;
202+
```
203+
204+
To manually update the selection for a group, just set it:
205+
```objective-c
206+
self.group.selectedCheckBox = self.checkBox1;
207+
```

0 commit comments

Comments
 (0)