宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-07-05 0d8f5fc8a516bfd07e425909e4a4432600572ee7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
//  HXTagsView.h
//  黄轩 https://github.com/huangxuan518
//
//  Created by 黄轩 on 16/1/13.
//  Copyright © 2015年 IT小子. All rights reserved.
//
 
#import <UIKit/UIKit.h>
#import "HXTagCollectionViewFlowLayout.h"
#import "EqualSpaceFlowLayoutEvolve.h"
@class HXTagAttribute;
 
@interface HXTagsView : UIView
/// 已选中的标签数组
@property (nonatomic,strong) NSMutableArray *selectedTags;
 
@property (nonatomic,strong) NSArray *tags;//传入的标签数组 字符串数组
@property (nonatomic,strong) EqualSpaceFlowLayoutEvolve *layout;//布局layout
@property (nonatomic,strong) HXTagAttribute *tagAttribute;//按钮样式对象
@property (nonatomic,assign) BOOL isMultiSelect;//是否可以多选 默认:NO 单选
@property (nonatomic,copy) NSString *key;//搜索关键词
@property (nonatomic,assign) BOOL isAdaptive;//是否需要自适应 默认需要NO,YES 不需要
 
@property (nonatomic,copy) void (^completion)(NSArray *selectTags,NSInteger currentIndex);//选中的标签数组,当前点击的index
 
//刷新界面
- (void)reloadData;
 
- (void)clearSelectedTags;
 
- (void) reloadSelectedTags:(NSArray *) tags;
/**
 *  计算Cell的高度
 *
 *  @param tags         标签数组
 *  @param layout       布局样式 默认则传nil
 *  @param tagAttribute 标签样式 默认传nil 涉及到计算的主要是titleSize
 *  @param width        计算的最大范围
 */
+ (CGFloat)getHeightWithTags:(NSArray *)tags layout:(HXTagCollectionViewFlowLayout *)layout tagAttribute:(HXTagAttribute *)tagAttribute width:(CGFloat)width;
/**
 *  计算Cell的高度
 *
 *  @param tags         标签数组
 *  @param layout       布局样式 默认则传nil
 *  @param tagAttribute 标签样式 默认传nil 涉及到计算的主要是titleSize
 *  @param width        计算的最大范围
 */
+ (CGFloat)getEqualSpaceFlowLayoutHeightWithTags:(NSArray *)tags layout:(EqualSpaceFlowLayoutEvolve *)layout tagAttribute:(HXTagAttribute *)tagAttribute width:(CGFloat)width;
 
/**
 *  计算Cell的高度,固定itemSize
 *
 *  @param tags         标签数组
 *  @param layout       布局样式 默认则传nil
 *  @param tagAttribute 标签样式 默认传nil 涉及到计算的主要是titleSize
 *  @param width        计算的最大范围
 *  @param size        itemSize
 */
+ (CGFloat)getEqualSpaceFixedHeightWithTags:(NSArray *)tags layout:(EqualSpaceFlowLayoutEvolve *)layout tagAttribute:(HXTagAttribute *)tagAttribute width:(CGFloat)width withItemSize:(CGSize)size;
@end