自定义 iOS14 PageControl 控件新功能

Overview

ZQEndlessPageControl

CI Status Version License Platform

功能

自定义 iOS14 PageControl 控件新功能 ☑️

  • 最大展示个数 ☑️
  • 设置大小、间隙、背景颜色 ☑️
  • 设置边框大小,颜色 ☑️
  • 设置大、中、小,三种状态的缩放系数 ☑️
  • 设置背景图 ☑️

效果

使用

配置对象

public struct ZQEndlessPageControlConfiguration {
    /// 总共点个数
    var numberOfDots: Int
    /// 支持最大展示多少个点
    var maxNumberOfDots: ZQEndlessPageControlMaxNumberOfDots
    /// 选择点的颜色
    var selectedDotColor: UIColor
    /// 未选择点的颜色
    var unselectedDotColor: UIColor
    /// 点大小
    var dotSize: CGFloat
    /// 点间隙
    var spacing: CGFloat
    /// 未选中的缩放系数
    var mediumScale: CGFloat
    /// 选中的缩放系数
    var selectedScale: CGFloat
    /// 最小的点的缩放系数
    var smallScale: CGFloat
    /// 点边框色
    var dotBorderColor: UIColor?
    /* 📢注意当设置了 selectedIndicatorImage & unselectedIndicatorImage 时候,不展示默认的圆点*/
    /// 当前选中展示图片
    var selectedIndicatorImage: UIImage?
    /// 当前未选中展示图片
    var unselectedIndicatorImage: UIImage?
}

DEMO

import ZQEndlessPageControl

fileprivate let indicatorPageControl1: ZQEndlessPageControlIndicator = ZQEndlessPageControlIndicator()
self.view.addSubview(indicatorPageControl1)
indicatorPageControl1.snp.makeConstraints { (make) in
    make.center.equalToSuperview()
}
    
let indicatorConfigure = ZQEndlessPageControlConfiguration(
    numberOfDots: Metric.indicatorPageDotNum,
    dotSize: 8,
    dotBorderColor: UIColor.black.withAlphaComponent(0.19)
)
indicatorPageControl1.setup(configuration: indicatorConfigure)

// 设置指示图的图标
if #available(iOS 13.0, *) {
    self.view.addSubview(indicatorPageControl3)
    indicatorPageControl3.snp.makeConstraints { (make) in
        make.centerX.equalToSuperview()
        make.top.equalTo(self.indicatorPageControl2.snp.bottom).offset(10)
    }
    
    
    let indicatorConfigure = ZQEndlessPageControlConfiguration(
        numberOfDots: Metric.indicatorPageDotNum,
        maxNumberOfDots: .seven,
        dotSize: 20,
        selectedIndicatorImage: UIImage(systemName: "sun.max.fill"),
        unselectedIndicatorImage: UIImage(systemName: "moon.fill")
    )
    
   indicatorPageControl3.setup(configuration: indicatorConfigure)
}

安装

ZQEndlessPageControl is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'ZQEndlessPageControl'

Author

zhengzeqin, [email protected]

Release Notes

  • v0.1.0: demo 展示
  • v0.2.0: 设置背景图 ☑️

License

ZQEndlessPageControl is available under the MIT license. See the LICENSE file for more info.

You might also like...
Releases(0.3.2)
Owner
zhengzeqin
zhengzeqin
This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl

NSPageControl This is PageControl Component for OS X. Inspired by UIPageControl and BFPageControl. Demo ##Installation NSPageControl supports multiple

Kohei Tabata 13 Jan 19, 2022
Fully Functional iOS14 Swift Chat app Using Firebase as backend.

Social Chat Messenger App This iOS14 Chat App is built with Swift in Xcode12 and Using Firebase as backend to authenticate users. Features Light and D

null 0 Nov 25, 2021
iOS14 widget to display/launch your COVID-19 vaccines

Vaccinated Widget to display/launch your recent COVID-19 vaccines. WIP.

Ellen Li 1 Jan 8, 2022
Workaround to hide/modify List separators in SwiftUI iOS13 and iOS14

Help support my open source work! iOS15 List finally supports setting list row separator color and style as of iOS15! They still don't support list in

Michael Schmidt 135 Dec 7, 2022