GARRadioButton 1.1

GARRadioButton 1.1

Genaro Arvizu 维护。



RadioButton

在 Swift 中实现 RadioButtons 的简单方法

特性

  • 在 iOS 中创建 RadioButtons
  • 自定义 RadioButtons
    • 颜色
    • 宽度
  • 可选控制器

要求

  • iOS 9+
  • Swift 4+

安装

pod 'GARRadioButton', '~> 1.0'

示例

  1. 创建一个 UIButton
  2. 前往 Identity Inspector,并将 RadioButton 设置为 和 GARRadioButton 设置为 模块

How to set RadioButton

  1. 前往 Attributes Inspector 并删除 默认标题 如何设置 RadioButton

  2. 在 ViewController 中设置 IBOutlets

  3. ViewController

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) {
        
    }
}