Coder Social home page Coder Social logo

swautosizelabelview's Introduction

SWAutoSizeLabelView

这是一个基于 UICollectionView 些的 tag 视图控件(我也不懂怎么描述,看看图片吧)

效果图

接入说明

  1. 支持 cocoapods 在 Podfile 中添加
pod 'SWAutoSizeLabelView'

执行 pod 安装命令即可

pod install
  1. 手动接入 将 AutoSizeLabelView 目录下的文件引入整个目录下,还需引入 pod 'Masonry' 即可使用。

使用说明

引入头文件

#import "swAutoSizeLabelView.h"
swAutoSizeLabelView _autoresizeLabelFlow = [swAutoSizeLabelView new];
[self.view addSubview:_autoresizeLabelFlow];
// 加好预约
[_autoresizeLabelFlow mas_makeConstraints:^(MASConstraintMaker *make) {
      make.top.mas_equalTo(self.view).mas_offset(20);
      make.left.mas_equalTo(self.view).mas_offset(20);
      make.height.mas_equalTo(50);
      make.width.mas_equalTo(50);
}];
 _autoresizeLabelFlow2.lineBreak = NO;
_autoresizeLabelFlow2.bounces = NO;
// 这里的 self.data 为数据详情看demo
_autoresizeLabelFlow2.data = self.data;
_autoresizeLabelFlow.textNormalColor = [UIColor redColor];
// 刷新数据
[_autoresizeLabelFlow2 reload];

// 点击单元格的回调
_autoresizeLabelFlow2.selectHandler = ^(NSUInteger index, swAutoSizeLabelModel *model) {
    NSLog(@"index - %ld title = %@",index,model.itemTitle);
};
// 完成布局时的回调
_autoresizeLabelFlow2.finshLayout = ^(CGSize size) {
    NSLog(@"with - %f \n height - %f",size.width,size.height);
};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.