RadioButton
在 Swift 中实现 RadioButtons 的简单方法
特性
- 在 iOS 中创建 RadioButtons
- 自定义 RadioButtons
- 颜色
- 宽度
- 可选控制器
要求
- iOS 9+
- Swift 4+
安装
pod 'GARRadioButton', '~> 1.0'
示例
- 创建一个 UIButton
- 前往 Identity Inspector,并将 RadioButton 设置为 类 和 GARRadioButton 设置为 模块
import UIKit
import GARRadioButton
class ViewController: UIViewController {
@IBOutlet weak var radioButtonOne: RadioButton!
@IBOutlet weak var radioButtonTwo: RadioButton!
var radioController: RadioButtonController!
override func viewDidLoad() {
super.viewDidLoad()
let arrRadioButtons: [RadioButton] = [radioButtonOne, radioButtonTwo]
radioController = RadioButtonController(arrRadioButton: arrRadioButtons)
}
}
extension ViewController: RadioButtonControllerDelegate {
func radioButton(_ radioButtonController: RadioButtonController, radioButton changed: RadioButton) {
}
}