DCHChangeStateButton
查看次数:1937
下载次数:366
上传时间:2017-11-21
大小:98 B
自定义一个菜单按钮,通过切换按钮状态,对列表数据进行排序,直接调用即可
for (int i = 0; i < titleArr.count; i++) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(i*width, 64, width, 40)];
view.backgroundColor = [UIColor orangeColor]; DCHChangeStateButton *c sharePriceSortBtntitle:titleArr color:[UIColor whiteColor] font:[UIFont systemFontOfSize:14] target:self action:@selector(changeStateAction:)];
CGFloat btnW = [self calculateWidth:titleArr fontsize:14 labelH:88*mh]+28;
conditionBtn.frame = CGRectMake(0, 0, btnW, 88*mh);
conditionBtn.centerX = view.width*0.5;
conditionBtn.centerY = view.height*0.5;
conditionBtn.tag = i+1;
[view addSubview:conditionBtn];
[self.view addSubview:view];
[self.btnArr addObject:conditionBtn];
}
收藏