- April 27, 2024
- Mins Read
A rubber animation pagecontrol
You can use CocoaPods to install TKRubberPageControl
by adding it to your Podfile
:
platform :ios, ‘8.0’
use_frameworks!
pod ‘TKRubberPageControl’
To get the full benefits import TKRubberPageControl
wherever you import UIKit
import UIKit
import TKRubberPageControl
Create a Cartfile
that lists the framework and run carthage update
. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/TKRubberPageControl.framework
to an iOS project.
github “tbxark/TKRubberIndicator”
TKRubberPageControl.swift
in your project.You can use closure or Target-Action to listen control event
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.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()
}
}
Key | Usage | |
---|---|---|
smallBubbleSize | 未选中小球尺寸 | 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 |
1.4.0 Swift 4.0
1.3.1 Bug Fixed
1.3.0 Support Swift 3.0
1.0.5 Fix bug, add Cocoapod and Carthage support
1.0.4 Complete basic functions
Horizon SDK is a state of the art real-time video recording / photo shooting iOS library. Some of the features ...