项目简介
TKRubberIndicator是一个胶状动画页面控制控件。
Swift3.0
iOS8.0+
Xcode8.0
安装CocoaPods
你可以使用CocoaPods在你的Podfile中加入如下完成安装 :
platform :ios, '8.0' use_frameworks!
pod 'TKRubberPageControl'
为了获得所有的功能,开题报告,开题报告,在import UIKit时要importTKRubberPageControl
import UIKit import TKRubberPageControl
手动
1.下载并吧TkRubberPageControl.swift放入你的文件
2.完成
使用案例这里提供 闭包和 传统的 Target-Action 两种方式
class ViewController: UIViewController {
let page = TKRubberIndicator(frame: CGRectMake(100, 100, 200, 100), count: 6) override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = UIColor(red:0.553, green:0.376, blue:0.549, alpha:1) page.center = self.view.center page.valueChange = {(num) -> Void in print('Closure : Page is \(num)') } page.addTarget(self, action: 'targetActionValueChange:', forControlEvents: UIControlEvents.ValueChanged) self.view.addSubview(page) // 可以变化 page 的个数 page.numberOfpage = 2 } @IBAction func pageCountChange(sender: UISegmentedControl) { page.numberOfpage = (sender.selectedSegmentIndex + 1) * 2 } func targetActionValueChange(page:TKRubberIndicator){ print('Target-Action : Page is \(page.currentIndex)') } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() }}
BaseKeyUsagesmallBubbleSize 未选中小球尺寸 unselect small ball size
mainBubbleSize 选中大球尺寸 select big ball size
bubbleXOffsetSpace 小球间距 The distance between the ball
bubbleYOffsetSpace 纵向间距 bubble Y Offset Space
animationDuration 动画时长 animation duration
backgroundColor 背景颜色 control background color
smallBubbleColor 小球颜色 unselect small ball color
mainBubbleColor 大球颜色 select big ball color
github地址:https://github.com/TBXark/TKRubberIndicator