/MSMarksButtonList

a list with lots of button just like a collection view

Primary LanguageObjective-CMIT LicenseMIT

MSMarksButtonList

License MIT Pod version Platform info Support

A group of buttons ,can be used to do a multiple choice component

Usage

Setting up padding:

MSButtonConfigurationModel

@property (nonatomic, assign) CGFloat edgeMargin
leading and trailing padding.
最左边的button和最右边的button距离组件两侧边缘的距离

@property (nonatomic, assign) CGFloat horMargin
Horizontal padding between buttons.
水平方向上button与button之间的距离

@property (nonatomic, assign) CGFloat verMargin
Vertical padding between buttons.
垂直方向上button与button之间的距离

@property (nonatomic, assign) CGFloat buttonHeight
height of button.
button的高度

@property (nonatomic, assign) CGFloat fromTopMargin
padding form top.
组件的top距离父view的top的距离.

@property (nonatomic, assign) CGFloat componentWidth
width of component.
组件的宽度

@property (nonatomic, getter=isHide) BOOL hide
hide when initial.
初始化时是否隐藏.

@property (nonatomic, assign) NSInteger numberInaLine
number of buttons in very line.
每一行button的数量


MSButtonConfigurationModel *configuration = [[MSButtonConfigurationModel alloc] initWithEdgeMargin:0.0f
                                                                                             horMargin:10.0f
                                                                                             verMargin:10.0f
                                                                                          buttonHeight:32.0f
                                                                                         fromTopMargin:160
                                                                                        componentWidth:[[UIScreen mainScreen] bounds].size.width
                                                                                         numberInALine:4];

Initialize buttonList:


MSMarksButtonList *buttonList = [[MSMarksButtonList alloc] initWithDataSource:[NSArray array]
                                                                       buttonType:MSButtonTypeOrderScore
                                                                    configuration:configuration];
                                                                    

Tips
I must convert your data model to button model(MSButtonModel),like example.

Requirements

  • ios 7+
  • ARC

Installation

MSMarksButtonList is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MSMarksButtonList"

Author

LinkRober

License

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