Latest 0.3.3
Homepage https://github.com/disburden/WGQRaidoGroup
License MIT
Platforms ios 9.0, requires ARC
Authors
使用超方便的单选组

Requirements

  • iOS 9+

Demo

demo列表

Installation

CocoaPods

use_frameworks!
pod ‘WGQRaidoGroup’

手动拖入

将 WGQRaidoGroup 文件夹拽入项目中即可使用

How To Use

        var baseInfo = RadioBaseInfo();
        baseInfo.normalImage = baseInfo.normalImage.reSizeImage(reSize: CGSize(width: imageSideLength, height: imageSideLength));
        baseInfo.selectImage = baseInfo.selectImage.reSizeImage(reSize: CGSize(width: imageSideLength, height: imageSideLength));

        //添加音乐输入模式单选组
        let inputRadioOptions = ["VOD","BGM","OPT"];
        inputRadioGroup = WGQRadioGroup(baseInfomation: baseInfo, options: inputRadioOptions,columnCount:1, delegate: self);
        if let radioGroup = inputRadioGroup
        {
            self.view.addSubview(radioGroup);
            radioGroup.translatesAutoresizingMaskIntoConstraints = false;
        }

        //添加布局
        let metrics = ["inputH":150,
                       "inputW":91,
                       ...]

        let bindings = ["inputRadioGroup":inputRadioGroup!,"effectRadioGroup":effectRadioGroup!];  
        var constraints = [NSLayoutConstraint]();  

        constraints += NSLayoutConstraint.constraints(withVisualFormat: "V:|-100-[inputRadioGroup(inputH)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: metrics, views: bindings);
        constraints += NSLayoutConstraint.constraints(withVisualFormat: "H:|-42-[inputRadioGroup(inputW)]", options: NSLayoutFormatOptions(rawValue: 0), metrics: metrics, views: bindings);
        constraints += .....

代理方法

extension ViewController:WGQRadioGroupProtocol {
    func valueDidChange(radioGroup: WGQRadioGroup, newIndex: Int) {
        if radioGroup == inputRadioGroup {
            print("更换音乐输入模式为:(newIndex)")
        }

        if radioGroup == effectRadioGroup {
            print("更换效果模式为:(newIndex)")
        }
    }
}

Next

约束按钮的image为正方形

Contact me

License

WGQRaidoGroup is available under the MIT license. See the LICENSE for more info.

Latest podspec

{
    "name": "WGQRadioGroup",
    "version": "0.3.3",
    "summary": "An easy to use radiogroup control.",
    "homepage": "https://github.com/disburden/WGQRaidoGroup",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "disburden": "disburden.gamil.com"
    },
    "platforms": {
        "ios": "9.0"
    },
    "screenshots": "https://raw.githubusercontent.com/disburden/WGQRaidoGroup/master/ScreenShots/screenshot1.png",
    "source": {
        "git": "https://github.com/disburden/WGQRaidoGroup.git",
        "tag": "0.3.3"
    },
    "source_files": "WGQRadioGroup/**/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This