Latest 1.0.1
Homepage https://github.com/HJXIcon/JXTagsView
License MIT
Platforms ios 8.0, requires ARC
Authors

1.支持拖动排序

2.支持拖动是否滚动,高度自动计算

3支持多选单选

标签控件


高度自适应

高度自适应


设置内边距

设置内边距


使用步骤

pod search JXTagsView –simple

pod ‘JXTagsView’, ‘~> 1.0.1’

// 0.如果应用有导航栏的话,需要设置
self.automaticallyAdjustsScrollViewInsets = NO;

// 1.标签数组
NSArray *tags = @[@"HJXIcon",@"晓梦影",@"iOS_icon",@"4乌尔奇奥拉",@"传统钓",@"台钓",@"手竿钓",@"海竿钓",@"抬竿钓(拉晃)",@"路亚",@"夜钓",@"冰钓",@"商业塘公da",@"野钓",@"竞技钓",@"休闲钓",@"商业塘公关钓",@"休闲钓",@"商业塘公关钓"];

__weak typeof(self) weakSelf = self;

// 2.设置属性
JXTagsAttribute *attribute = [[JXTagsAttribute alloc]init];
// 圆角
attribute.isShowCorner = YES;
attribute.edgeInsets = UIEdgeInsetsMake(5, 10, 15, 20);

// 3.创建tagsView
JXTagsView *tagsView = [[JXTagsView alloc]initWithFrame:CGRectZero Tags:tags TagAttribute:attribute UpdateFrame:^(CGFloat currentHeight) {
    dispatch_async(dispatch_get_main_queue(), ^{

        // 更新frame
        weakSelf.tagsView.frame = CGRectMake(0, 64, self.view.bounds.size.width, currentHeight);
    });
} completion:^(NSArray<NSNumber *> *selectArray, NSArray<NSString *> *tags) {

    NSLog(@"selectArray == %@",selectArray);
    NSLog(@"tags == %@",tags);
}];

_tagsView = tagsView;
tagsView.isMultiSelect = YES;
tagsView.isSort = YES;

// 4.计算高度(如果标签不能滚动的话,需要先计算出所有的标签总体高度)
CGFloat height = [tagsView getHeightWithMaxWidth:self.view.bounds.size.width];
tagsView.frame = CGRectMake(0, 64, self.view.bounds.size.width, height);
tagsView.backgroundColor = [UIColor redColor];

// 5.添加
[self.view addSubview:tagsView];

Latest podspec

{
    "name": "JXTagsView",
    "version": "1.0.1",
    "summary": "u6807u7b7eu63a7u4ef6uff0cu5c01u88c5u7b80u5355uff0cu6613u4f7fu7528uff0cu652fu6301u62d6u62fdu6392u5e8fu3001u5355u591au9009u3001u9ad8u5ea6u81eau9002u5e94",
    "homepage": "https://github.com/HJXIcon/JXTagsView",
    "license": "MIT",
    "authors": {
        "HJXIcon": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/HJXIcon/JXTagsView.git",
        "tag": "1.0.1"
    },
    "source_files": "JXTagsView/JXTagsView/JXTagsView/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This