HorizontalPageControlView
👨💻 Installation
Manual
1. Download and drop [HorizontalPageControlView.swift] in your project
2. Configuration
Carthage
- Add
github "jinsky90/HorizontalPageControlView"to yourCartfile.
Cocoapods
- Add pod
HorizontalPageControlViewto your pod file.
👩🍳 Usage
1. Drop HorizontalPageControlView.swift in your project
2. Make UIView in StoryBoard
3. Designate Custom Class ‘HorizontalPageControlView’ in your PageControlView
4. Add code
@IBOutlet weak var pageControl: HorizontalPageControlView!
override func viewDidLoad() {
super.viewDidLoad()
self.setPageControlTotalCount()
}
func setPageControlTotalCount() {
// must set HorizontalPageControlView totalPageCount
self.pageControl.totalPageCount = 7
}
extension ViewController: UICollectionViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
// must set HorizontalPageControlView indicatorOffset
let offset = scrollView.contentOffset.x / scrollView.bounds.width
self.pageControl?.indicatorOffset = offset
}
}👩🎨 Attribute
// set SelectedColor in indicator
@IBInspectable var selectedColor: UIColor? {
didSet { self.setNeedsDisplay() }
}
// set TotalCount
var totalPageCount: Int = 0 {
didSet { self.setNeedsDisplay() }
}
// set Offset
var indicatorOffset: CGFloat = 0 {
didSet { self.setNeedsDisplay() }
}
// usally get index in indicator
var selectedPosition: Int {
get { return Int(round(self.indicatorOffset)) }
set { self.indicatorOffset = CGFloat(newValue) }
}
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.




