
image
-(UIView *)text{
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, YGScreenWidth, 80)];
footerView.backgroundColor = [UIColor whiteColor];
NSInteger toLeft = 10;
// NSArray *array = @[@"液晶电视",@"茶水饮品",@"电脑",@"茶水饮品",@"茶水饮品",@"茶水饮品",@"茶水饮品",@"茶水饮品",@"茶水饮品",@"设备物品",@"全面配套服务",@"价格体系公道",@"电脑",@"音响",@"电视",@"音响",@"电视",@"投影仪",@"麦克风"];
NSMutableArray *array = [NSMutableArray array];
for (int i = 0; i<self.equipsMutableArray.count; i++) {
[array addObject:[self.equipsMutableArray[i] valueForKey:@"equipName"]];
}
int k = 0;
CGFloat widthCount = 0.0f;
int j = 0;
for (int i = 0;i<array.count;i++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:array[i] forState:UIControlStateNormal];
button.titleLabel.font = [UIFont systemFontOfSize:YGFontSizeSmallOne];
[button.titleLabel sizeToFit];
[button setTitleColor:colorWithDeepGray forState:UIControlStateNormal];
[button setTitleColor:colorWithMainColor forState:UIControlStateSelected];
button.backgroundColor = [UIColor clearColor];
button.tag = 100+i;
[button addTarget:self action:@selector(titleChooseChangeContentAction:) forControlEvents:UIControlEventTouchUpInside];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 24)];
label.font = [UIFont systemFontOfSize:YGFontSizeSmallOne];
label.text = array[i];
label.textColor = colorWithMainColor;
[label sizeToFit];
CGFloat labeWidth = label.width+20;
button.frame = CGRectMake(toLeft+widthCount+k*5, 10+30*j, labeWidth-10, 24) ;
widthCount = widthCount +labeWidth;
if (widthCount>(YGScreenWidth-toLeft-10-k*5)) {
j=j+1;
k=0;
widthCount = 0.0f;
button.frame = CGRectMake(toLeft+widthCount+k*5, 10+30*j, labeWidth-10, 24);
widthCount = widthCount +labeWidth;
}
button.layer.cornerRadius = 3;
button.layer.borderColor = colorWithLightGray.CGColor;
button.layer.borderWidth = 0.8;
k++;
[footerView addSubview:button];
}
footerView.frame = CGRectMake(0, 30, YGScreenWidth, 10+30*(j+1));
return footerView;
}