当前位置:网站首页>Swift control encapsulation - paging controller
Swift control encapsulation - paging controller
2022-07-01 09:27:00 【Strive to repair the blessings】
The code is based on swift5.0
Code warehouse :https://github.com/CDLOG/swift5_CLJPageview
preview
Encapsulated simple paging controller , Simple and easy to use
Initialization code
/ title view Related initialization
let titles = [" game "," entertainment "," live broadcast "," Scenery scenery "," Games games games "," entertainment "," live broadcast "," scenery "]
//titleview To configure
let titleStyle = CLJPageView_title_style()
titleStyle.titleHeight = 45
// Scrolling
titleStyle.isShowScrollLine = true
// Content controller related initialization
var childs = [UIViewController]()
for _ in titles {
let vc = UIViewController()
// Controller background color
vc.view.backgroundColor = UIColor.randomColor()
// Change to the controller you need
childs.append(vc)
}
// Paging control initialization
let frame = CGRect(x: 0, y: 64, width: view.bounds.width, height: view.bounds.height - 64)
let pageView = CLJPageView(frame: frame, titles: titles, childsVC: childs, parentVc: self, titleStyle: titleStyle)
view.addSubview(pageView)
The configurable properties of the top scroll bar are as follows
/// Scrollable or not
var isScrollEnable:Bool = true
/// Height
var titleHeight = 44
/// Common color
var normalColor:UIColor = UIColor(r: 0, g: 0, b: 0)
/// Choose a color
var selectColor:UIColor = UIColor(r: 255, g: 127, b: 0)
/// Normal font size
var normalFont:CGFloat = 15.0
/// Select font size
var selectFont:CGFloat = 18.0
/// Spacing when scrolling
var itemMargin:CGFloat = 30
/// Is there a scroll bar
var isShowScrollLine:Bool = false
/// Scroll bar height
var scrollLineHeight:CGFloat = 2
/// Scroll bar color
var scrollLineColor:UIColor = .orange
边栏推荐
- Naoqi robot summary 28
- Redis source code learning (29), compressed list learning, ziplist C (II)
- Redis -- lattice connects to redis cluster
- Bird recognition app
- 记一次redis超时
- [ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DS18B20 temperature sensor +nodejs local service + MySQL database
- Understanding and implementation of AVL tree
- 【pytorch】transforms. Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
- Databinding source code analysis
- 韦东山板子编译内核问题解决
猜你喜欢
Daily practice of C language - day 80: currency change
Network counting 01 physical layer
樹結構---二叉樹2非遞歸遍曆
PR training notes
树结构---二叉树2非递归遍历
2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据
Dspic30f6014a LCD block display
Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
JS原型链
delete和delete[]引发的问题
随机推荐
ES6 decoupling top-level objects from windows
Football and basketball game score live broadcast platform source code /app development and construction project
[ESP nanny level tutorial] crazy completion chapter - Case: chemical environment system detection based on Alibaba cloud and Arduino, supporting nail robot alarm
js重写自己的函数
SQL学习笔记(04)——数据更新、查询操作
Short circuit operator lazy evaluation
ES6-const本质与完全不可改实现(Object.freeze)
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DHT11 +nodejs local service + MySQL database
Error org apache. catalina. core. StandardContext. FilterStart start filter exception
【pytorch】nn. Crossentropyloss() and nn NLLLoss()
Preparing for the Blue Bridge Cup -- bit operation
js原型继承仅可继承实例而非构造器
Serialization, listening, custom annotation
Bird recognition app
FAQ | FAQ for building applications for large screen devices
Analysis and solution of JS this loss
Construction of esp8266 FreeRTOS development environment
PHP merges multiple arrays. The same element takes the intersection of different elements to form an array
How to realize the usage of connecting multiple databases in idel
2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder