IRRadioButton-iOS 0.1.0

IRRadioButton-iOS 0.1.0

irons163 维护。



  • irons163

Build Status Platform

IRRadioButton-iOS

  • IRRadioButton-iOS 是一个强大的 iOS 单选按钮。
  • 一个简单的类,扩展了标准 UIButton 功能。可以为每个按钮配置默认和选中状态。

功能

  • 单选按钮

安装

Git

  • 克隆此项目。
  • 将此项目复制到您的项目中。
  • 将 .xcodeproj 添加到您的项目中,并将其作为嵌入框架链接。

选项

  • 您可以删除 demoScreenShots 文件夹。

Cocoapods

  • Podfile 中添加 pod 'IRRadioButton-iOS'
  • 执行 pod install

使用方法

基础

无需任何中央管理器。只需在 Interface Builder 中直接链接按钮:Interface Builder

或者使用单行代码组合按钮

radio1.groupButtons = @[radio1, radio2, radio3];

选择任意按钮,同一组中的所有其他按钮将自动取消选中

radio2.selected = YES; // radio1 and radio3 become deselected

组内的任何按钮都知道哪个被选中

IRRadioButton* r1 = radio1.selectedButton;
IRRadioButton* r2 = radio2.selectedButton;
IRRadioButton* r3 = radio3.selectedButton;
NSAssert (r1==r2 && r2==r3, @"Must be equal");

以及选择按钮的标签的实用方法

[radio1 setSelectedWithTag:kTagRadio3];

截图

Demo

版权

本项目灵感来源于 RadioButton-iOS