VLUniversalControl
VLUniversalControl 是一个用于轻松添加分页功能的 Swift 框架。
如果您想查看更多视图示例,可以打开 Sample/ExapleView 并选择它们。您需要做的所有更改都在 ViewController 中的 loadView 方法中,名称为 Sample/ExapleView 中的 View。
📲
安装VLUniversalControl 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod 'VLUniversalControl'
功能
- 指示选中项
- 指示取消选中项
- 动态更新样式
- 仅项目标签
- 仅项目图片
- 标签到项目图片
- 图片到项目标签
- 横向水平和垂直项目
- 水平和垂直标签与图片
- 项目动态长度
- 项目静态长度
- 控制动态长度
- 控制静态长度
- 根据文本宽度计算项目长度
- 自定义项目长度
- 支持向项目添加自定义对象
- 支持垂直控制
用法
import VLUniversalControl
self.universalControlView = VLUniversalControlView()
//give your frame size for VLUniversalControlView
//or add constraints
//item height will equel to (VLUniversalControlView *)universalControlView.frame.size.height
self.view.addSubview(self.universalControlView)
// Each as you add new attributes control will be update
universalControlView.items.set(items: [standartViewAttribute,...,standartViewAttribute])
//To append item
universalControlView.items.append(item:standartViewAttribute)
项目可用属性
// Only for title and image
let standartViewAttribute = VLStandartViewCellAttribute()
// If alignment only image it will be non creating
standartView.title = "Your Title"
// If alignment only title it will be non creating
standartView.imageName = "Your Image"
standartView.alignment = .onlyImage
// Only for adding inside container `yourview`
let containerViewAttribute = VLContainerViewCellAttribute()
containerView.view = yourView
VLUniversalControlView already have a lot different style properties. You can add style to item or for items.
关于项
let standartView = VLStandartViewCellAttribute()
// only for cell style
standartView.style = standartViewStyle
关于项目
var style = VLCollectionViewStyle()
style.backgroundColor = UIColor.brown
style.itemsBackgroundColor = UIColor.red
style.itemWidth = 175
style.spacingBetweenItems = 5
style.itemsBorderColor = UIColor.green
style.itemBorderRadius = ([.layerMaxXMaxYCorner], 5)
style.itemsBorderSide = [.top, .bottom]
style.itemsBorderWidth = 10
style.itemsBorderColor = .green
self.universalControlView.optionsUniversalControl.style = style