diff --git a/cocos/ui/UIRadioButton.cpp b/cocos/ui/UIRadioButton.cpp index bcd48fd7a3..a5c8e573a9 100644 --- a/cocos/ui/UIRadioButton.cpp +++ b/cocos/ui/UIRadioButton.cpp @@ -224,6 +224,14 @@ void RadioButtonGroup::removeRadioButton(RadioButton* radioButton) } } +void RadioButtonGroup::removeAllRadioButtons() +{ + while(!_radioButtons.empty()) + { + removeRadioButton(_radioButtons.at(0)); + } +} + ssize_t RadioButtonGroup::getNumberOfRadioButtons() const { return _radioButtons.size(); diff --git a/cocos/ui/UIRadioButton.h b/cocos/ui/UIRadioButton.h index 26d982451d..dda9f3ce89 100644 --- a/cocos/ui/UIRadioButton.h +++ b/cocos/ui/UIRadioButton.h @@ -218,6 +218,11 @@ public: */ virtual void removeRadioButton(RadioButton* radioButton); + /** + * Remove all radio button from this group. + */ + virtual void removeAllRadioButtons(); + /** * Get the number of radio buttons in this group. *