🚀🚀🚀 自定义pageControl指示器, 支持多种动画, 自定义布局.
(If there is any problem, you can leave a message, welcome to study together, welcome star )
To install, simply add the following code to your Podfile :
platform :ios, '8.0'
target 'TargetName' do
pod 'JXPageControl'
end
JXPageControlChameleon | JXPageControlExchange | JXPageControlFill |
---|---|---|
JXPageControlJump | JXPageControlScale |
---|---|
JXPageControl ADAPTS to Swift and objective-c
JXPageControl also provides some APIs for non-JXPageControlType. You can view it in the specific classes you use
import JXPageControl
class ChamelonVC: UIViewController {
lazy var codePageControl: JXPageControlJump = {
let pageControl = JXPageControlJump(frame: CGRect(x: 0,
y: 0,
width: UIScreen.main.bounds.width,
height: 30))
pageControl.numberOfPages = 4
// JXPageControlType: default property
// pageControl.currentPage = 0
// pageControl.progress = 0.0
// pageControl.hidesForSinglePage = false
// pageControl.inactiveColor = UIColor.white.withAlphaComponent(0.5)
// pageControl.activeColor = UIColor.white
// pageControl.inactiveSize = CGSize(width: 10, height: 10)
// pageControl.activeSize = CGSize(width: 10, height: 10)
// pageControl.inactiveSize = CGSize(width: 10, height: 10)
// pageControl.columnSpacing = 10
// pageControl.contentAlignment = JXPageControlAlignment(.center,
// .center)
// pageControl.contentMode = .center
// pageControl.isInactiveHollow = false
// pageControl.isActiveHollow = false
// JXPageControlJump: default "custom property"
pageControl.isAnimation = true
pageControl.isFlexible = true
return pageControl
}()
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(codePageControl)
}
}
extension ChamelonVC: UIScrollViewDelegate {
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let progress = scrollView.contentOffset.x / scrollView.bounds.width
let currentPage = Int(round(progress))
// Mode one
codePageControl.progress = progress
// Mode two
// codePageControl.currentPagev = currentPage
}
}
import JXPageControl
...
Code-TanJX, [email protected]
JXPageControl is available under the MIT license. See the LICENSE file for more info.