Skip to content

不规则按钮自动换行及单选功能的简单实现

Notifications You must be signed in to change notification settings

haolizi/IrregularButton

Repository files navigation

IrregularButton

不规则按钮自动换行及单选功能的简单实现

Usage

//初始化
HLZIrregulatBtn *irregulatBtn = [[HLZIrregulatBtn alloc]initWithFrame:CGRectMake(15, 150, self.view.frame.size.width - 30, self.view.frame.size.height)];
[self.view addSubview:irregulatBtn];

//数据源
NSArray *listArray = @[@"张三",
                       @"李四",
                       @"隔壁老王",
                       @"麻声稀饭",
                       @"啪啪",
                       @"irregularButton",
                       @"newline",
                       @"over"];
[irregulatBtn getArrayDataSourse:listArray];

//点击事件回调
[irregulatBtn setChooseBlock:^(UIButton *button) {
    NSLog(@"index:%ld    indexName:%@",(long)button.tag,listArray[button.tag]);
}];

//重置frame
CGSize size = [irregulatBtn returnSize];
irregulatBtn.frame = CGRectMake(15, 150, self.view.frame.size.width - 30, size.height);
NSLog(@"%f",size.height);

效果图: image

About

不规则按钮自动换行及单选功能的简单实现

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published