CHIPageControl 0.2

CHIPageControl 0.2

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2019年8月
SPM支持SPM

Maintained by Chili iOS.



  • 作者:
  • Chili

CHIPageControl

CHIPageControl是一组酷炫的动画页码控制,用于替代无聊的UIPageControl。我们受到了Jardson Almeida dribbble拍摄的启发,并实现了更多的页码控制。

❤️Chili团队制作。

概述

系统要求

  • iOS 8.0+
  • Xcode 8+
  • Swift 3

安装

手动方式

只需将 CHIPageControl 文件夹添加到您的项目中。

CocoaPods

使用 CocoaPods 与 Podfile

pod 'CHIPageControl', '~> 0.1.3'

# individual page control
pod 'CHIPageControl/Aji'
pod 'CHIPageControl/Aleppo'
pod 'CHIPageControl/Chimayo'
pod 'CHIPageControl/Fresno'
pod 'CHIPageControl/Jalapeno'
pod 'CHIPageControl/Jaloro'
pod 'CHIPageControl/Paprika'
pod 'CHIPageControl/Puya'

Carthage

使用 Carthage 与 Cartfile

github "ChiliLabs/CHIPageControl" ~> 0.1.3

使用方法

🎨Storyboards

只需将 UIView 拖拽下来,并将其类设置为 CHIPageControls 中的任何一个。

💻代码

let pageControl = CHIPageControlAji(frame: CGRect(x: 0, y:0, width: 100, height: 20))
pageControl.numberOfPages = 4
pageControl.radius = 4
pageControl.tintColor = .red
pageControl.currentPageTintColor = .green
pageControl.padding = 6

添加多个 tintColors

// The size of the array needs to match the numberOfPages or it will throw an fatal error
pageControl.tintColors = [UIColor.black, UIColor.yellow, UIColor.black, UIColor.black]

// or

// If it is the first one, it will fill all colors with the selected tintColor and then replace the colors with the desired one
pageControl.insertTintColor(UIColor.yellow, position: 1)

更新进度

//update dynamically
pageControl.progress = 0.5

//set progress with animation
pageControl.set(progress: 2, animated: true)

触摸事件

您可以在页面指示器的任何位置听到触摸事件。

pageControl.enableTouchEvents = true

委托

实现CHIBasePageControlDelegate来捕获触摸事件。

func didTouch(pager: CHIBasePageControl, index: Int)

页面控制器🌶️🌶️🌶️

CHIPageControlAji

CHIPageControlAleppo

CHIPageControlChimayo

CHIPageControlFresno

CHIPageControlJalapeno

CHIPageControlJaloro

CHIPageControlPaprika

CHIPageControlPuya

许可证

CHIPageControl遵循MIT许可证发布。有关详细信息,请参阅LICENSE