当前位置:网站首页>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
边栏推荐
- Weidongshan board compilation kernel problem solving
- [pytorch learning] torch device
- Nacos service configuration and persistence configuration
- Bird recognition app
- 2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据
- JS prototype trap
- SQL学习笔记(03)——数据约束关系
- Closure implementation iterator effect
- MT7628K eCos开发入门
- Reproduced Xray - cve-2017-7921 (unauthorized access by Hikvision)
猜你喜欢

集成积木报表报错 org.apache.catalina.core.StandardContext.filterStart 启动过滤器异常

Construction of esp8266 FreeRTOS development environment

Installation and use of NoSQL database

【电赛训练】红外光通信装置 2013年电赛真题

【无标题】

2.4 激活函数

nacos简易实现负载均衡

【检测技术课案】简易数显电子秤的设计与制作

Structure de l'arbre - - - arbre binaire 2 traversée non récursive

计网01-物理层
随机推荐
Wechat applet WebView prohibits page scrolling without affecting the implementation of overflow scrolling in the business
[pytorch] 2.4 convolution function nn conv2d
Implementation and application of queue
JS use toString to distinguish between object and array
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
Learning practice: comprehensive application of cycle and branch structure (II)
I use flask to write the website "one"
Set the type of the input tag to number, and remove the up and down arrows
Closure implementation iterator effect
node. How to implement the SQL statement after JS connects to the database?
Meituan machine test in 2022
laravel postman 提交表单出现419错误。2020年7月6日记。
【ESP 保姆级教程 预告】疯狂Node.js服务器篇 ——案例:ESP8266 + MQ系列 + NodeJs本地服务 + MySql存储
【无标题】
Click the screen with your finger to simulate F11 and enter the full screen
韦东山板子编译内核问题解决
Mysql8.0 learning record 17 -create table
nacos簡易實現負載均衡
[interview brush 101] linked list
nacos简易实现负载均衡