LXPageControl
LXPageControl 是一个带有线条的简单 PageControl。
要求
- Swift 4+
- iOS 9.0+
- Xcode 8+
安装
CocoaPods
您可以使用 CocoaPods 通过将其添加到您的 Podfile
中安装 LXPageContrl
pod 'LXPageControl'
Carthage
创建一个包含框架的 Cartfile
并运行 carthage update
。遵循 说明 将 $(SRCROOT)/Carthage/Build/iOS/YourLibrary.framework
添加到 iOS 项目中。
github "yourUsername/yourlibrary"
使用方法
您可以通过代码创建“LinePageControl”或者通过Interface Builder。
通过Interface Builder
创建一个“UIView”并为其分配“LinePageControl”类。在Xcode属性检查器中自定义您的页面。
通过代码
创建一个“LinePageControl”实例。
按钮高度等于视图的高度。
let linePageControl = LinePageControl()
self.view.addSubview(linePageControl)
其他方法和属性
公开方法
linePageControl.set(progress: Int, animated: Bool) // to change the current progress
公开属性
linePageControl.leftBtn: UIButton // button to decrease progress
linePageControl.rightBtn: UIButton // button to increase progress
linePageControl.pages: Int // count of Pages
linePageControl.elementWidth: CGFloat // width of an element
linePageControl.elementHeight: CGFloat // height of an element
linePageControl.spacing: CGFloat // spacing between elements
linePageControl.inactiveColor: UIColor // color of inactive elements
linePageControl.activeColor: UIColor // color of active element
linePageControl.cornerRadius: CGLoat // corner radius of the elements
linePageControl.fillWidthAutomatically: Bool // determines automatically the width of each element and fill the entire view width depending on the spacing
代理
linePageControl.delegate = self
代理协议
public protocol LinePageControlDelegate {
func linePageControl(_ linePageControl: LinePageControl, didPressedOn button: UIButton)
func linePageControl(_ linePageControl: LinePageControl, changeProgress to: Int)
}
捐赠
如果您喜欢我的开源库,您可以赞助它!
作者
Leon Hoppe, [email protected]
许可
在MIT许可下分发。更多信息请参阅LICENSE
文件。