// // Classification_view.m // iphoneLive // // Created by bugu on 2018/12/6. // Copyright © 2018年 cat. All rights reserved. // #import "Classification_view.h" #import "UIView+Additions.h" @implementation Classification_view - (instancetype)init { self =[super init]; self.backgroundColor =UIColorFromRGB(0xffffff); return self; } - (UIScrollView *)scrollview { if (!_scrollview) { _scrollview =[[UIScrollView alloc]init]; [self addSubview:_scrollview]; [_scrollview mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.height.right.equalTo(self); // make.width.equalTo(self).offset(-44); }]; _scrollview.showsHorizontalScrollIndicator = NO; // UIButton *allBtn =[[UIButton alloc]init]; // [self addSubview:allBtn]; // [allBtn mas_makeConstraints:^(MASConstraintMaker *make) { // make.right.top.height.equalTo(self); // make.width.equalTo(@44); // }]; // [allBtn setImage:[UIImage imageNamed:@"hm_img_hot_class"] forState:0]; // [allBtn addTarget:self action:@selector(allAction) forControlEvents:UIControlEventTouchUpInside]; // allBtn.hidden = YES; // UIView *fg =[[UIView alloc]init]; // fg.backgroundColor =UIColorFromRGB(0xf5f5f5); // [self addSubview:fg]; // [fg mas_makeConstraints:^(MASConstraintMaker *make) { // make.right.equalTo(allBtn.mas_left); // make.width.equalTo(@1); // make.height.equalTo(@25); // make.centerY.equalTo(self); // }]; } return _scrollview; } - (void)allAction { if ([_delegate respondsToSelector:@selector(showAllClass)]) { [_delegate showAllClass]; } } - (void)setClassWithAry:(NSArray *)ary { [self.scrollview removeAllSubViews]; _data_ary =[ary copy]; CGFloat item_w =10,item_h =25; for (int i=0; i