swift iOS 不规则标签 - tagView1

📅 2026-12-01 👤 拼多多助力营销技巧 📂 拼多多助力网站平台 👁️ 518 次阅读

iOS 不规则标签排列

把 XHTagView 拖入项目 需依赖 SnapKit

//左右排列 可滑动

let tagView1 = XHTagView(frame: CGRect(x: 0, y: 150, width: view.frame.width, height: 25))

tagView1.direction = .vertical //展示方向

tagView1.titleBtnH = 25 //标签的高度

tagView1.titleColor = .white //字体颜色

tagView1.titleFont = UIFont.systemFont(ofSize: 12) //文字字体

tagView1.padding = 15 //标签离背景左右间距 拼多多帮助力入口

tagView1.minimumInteritemSpacing = 15 //标签之间间距

tagView1.bgColor = .blue //标签背景颜色

tagView1.tagInsets = UIEdgeInsets(top: 2, left: 4, bottom: 2, right: 4) //文字离标签间距

tagView1.radius = 5 //标签圆角

tagView1.didSelectTagCallback { index in //标签点击回调

print("index: \(index)")

}

v

好文推荐

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧