mohn93/AdvancedPageControl
소개
간단하면서도 강력한 애니메이션 페이지 컨트롤 인디케이터입니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalAdvancedPageControl
A simple yet powerful page control indicator animations library for iOS, Written in Swift.
Example
To run the example project, clone the repo, and run pod install from the Example directory first.
Installation
AdvancedPageControl is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AdvancedPageControl'
Effects
- Color Blend
- Drop
- ExtendedDot
- Jump
- Scale
- Slide
- Swap
- Worm
- ThinWorm
- ThinWormHead
- Scrolling
- Infinite
Usage
I'm using it with expanded UICollectionView, create a collection view and link the DataSource and Delegate to your ViewController, and add UICollectionViewDeleageFlowLayout
class ViewController: UIViewController,
UICollectionViewDataSource,
UICollectionViewDelegate,
UICollectionViewDelegateFlowLayout { ....
Then add these methods:
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 5
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
return collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
}
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width, height: 250) // This is to restric the item width and heigth to achive the single item preview
}
Tick 'Scrolling enabled' and 'Paging enabled' Checkboxes in storyboard UICollectionView properties
Then add this method and pass the offset of the scrolling for UICollectionView, and width of the UICollectionView, to the pageControl , setCurrentItem, Method
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offSet = scrollView.contentOffset.x
let width = scrollView.frame.width
pageControl.setPageOffset(offSet/width)
// OR
let index = Int(round(offSet/width))
pageControl.setPage(index) // This will animate the page controll transition, whenever the index is changed, no need to pass an offset of every scroll offset
}
Then set any drawer you like in viewDidLoad Method :
pageControl1.drawer = ColorBlendDrawer()
or you can pick one of these
ColorBlendDrawer()
DropDrawer()
ExtendedDotDrawer()
JumpDrawer()
ScaleDrawer()
SlideDrawer()
SwapDrawer()
ThinWormDrawer()
ThinWormHeadsDrawer()
WormDrawer()
Scrolling()
Infinite()

Customization
ScaleDrawer(numberOfPages:Int? = 5,
height: CGFloat? = 16,
width: CGFloat? = 16,
space: CGFloat? = 16,
radius: CGFloat? = 16,
currentItem: CGFloat? = 0,
indicatorColor: UIColor? = .red,
dotsColor: UIColor? = .lightGray)
Author
Mohanned Binmiskeen, [email protected]
License
AdvancedPageControl is available under the MIT license. See the LICENSE file for more info.
관련 프로젝트 살펴보기
불러오는 중…
