Latest 0.1.0
Homepage https://github.com/adampei/ScrollTagsView
License MIT
Platforms ios 9.0, requires ARC
Authors

样式展示

  • 如果所传tag数组元素比较多,超过view后可以滚动

image

当控件总宽度 < view 的宽度的时候,有两种布局方式

  • 平铺样式,依然按照给定的margin进行布局tagView.isConstrainPlain = true

image

  • 普通布局tagView.isConstrainPlain = false

image

如何使用

  • 创建tagview
/// 创建view
let tagView = ScrollTagsView(frame: CGRect.init(x: 0, y: 100, width: UIScreen.main.bounds.size.width, height: 35))
view.addSubview(tagView)
/// 标题数组
let titleArray = ["我该使用", "什么", "方法", "implemented", "这", "可以", "支持一", "个长文本", "短文本", "等等都可以", "非常awesome"]
//        let titleArray = ["我该使用", "什么", "方法",]
/// 默认选中第几个
tagView.defaultSelect = 0
/// 设置字体大小
tagView.fontSize = UIFont.systemFont(ofSize: 13)
/// 左侧距离屏幕边 距离
tagView.marginLeft = 30
/// 非选中状态颜色
tagView.colorNormal = .black
/// 选中文字颜色
tagView.colorSelected = .red
/// 设置背景色
//        tagView.colorBackground = .blue
/// 线比字宽出多少
tagView.lineOutOfWordsWidth = 15
/// 如果控件较少 是否均分展示
tagView.isConstrainPlain = false
/// 底部滚动线条颜色
tagView.colorLine = .red
/// 是否展示线条
tagView.isHideLine = false
/// 线条高度
tagView.heightLine = 2
tagView.createView(titleArray)
/// 点击事件回调
tagView.tapCallback = {idx in
    print(idx)
}

Latest podspec

{
    "name": "ScrollTagsView",
    "version": "0.1.0",
    "summary": "u4e00u4e2au70b9u51fbu6ed1u52a8u7684TagView",
    "description": "u4e00u4e2au70b9u51fbu6edau52a8u7684TagScrollViewu5bfcu822au6761",
    "homepage": "https://github.com/adampei/ScrollTagsView",
    "license": "MIT",
    "authors": {
        "u88f4u6ce2u6ce2": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/adampei/ScrollTagsView.git",
        "tag": "0.1.0"
    },
    "source_files": "AweSomeScrollTagView/ScrollTagsView.swift",
    "exclude_files": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This