RadioAndCheckboxButton
RadioButton 和 CheckboxButton 是 UIButton 控件的子类。您可以使用 RadioButton 和 CheckboxButton 如同使用 UIButton。它为您提供了按钮的动画和不同样式。您可以分组按钮以利用更多功能。它自动管理 RadioButton 和 CheckboxButton 的所有选择/取消选择。
CheckboxButton
默认样式
自定义样式
RadioButton
默认样式
自定义样式
安装
CocoaPods
CocoaPods 是 Cocoa 项目的依赖关系管理器。您可以使用以下命令安装它
$ gem install cocoapods
要在您的 Xcode 项目中使用 CocoaPods 集成 RadioButton 和 CheckboxButton,在您的 Podfile
中指定它
target '<Your Target Name>' do
pod 'MBRadioCheckboxButton'
end
如果需要,您可以集成单个按钮控件。
target '<Your Target Name>' do
pod 'MBRadioButton'
end
target '<Your Target Name>' do
pod 'MBCheckboxButton'
end
然后,运行以下命令
$ pod install
如何使用
使用很简单,只需将 RadioButton 或 CheckboxButton 分配给 XIB 中的按钮。您可以使用 [RadioButtonContainerView] (Source/RadioButton/RadioButtonContainerView.swift) 或 CheckboxButtonContainerView 将按钮组合起来。将所有按钮添加到 UIView,并将相应的容器类分配给视图。有关更多详细信息,请参阅 RadioAndCheckboxButtonDemo 示例。它有 CheckboxButtonDelegate 和 RadioButtonDelegate 来获取按钮选择和取消选择的回调。
自定义
有关更多自定义,请参阅 RadioAndCheckboxButtonDemo 示例。