LXPageControl 1.0.0

LXPageControl 1.0.0

Maintained by Leon Hoppe.



  • By
  • Leon Hoppe

LXPageControl

Swift Version Build Status License Carthage compatible CocoaPods Compatible
Platform PRs Welcome

LXPageControl is a simple PageControl with lines.

Requirements

  • Swift 4+
  • iOS 9.0+
  • Xcode 8+

Installation

CocoaPods

You can use CocoaPods to install LXPageContrl by adding it to your Podfile:

pod 'LXPageControl'

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/YourLibrary.framework to an iOS project.

github "yourUsername/yourlibrary"

Usage

Either you can create the 'LinePageControl' programmatically or via Interface Builder.

Via Interface Builder:
Create a 'UIView' and assign 'LinePageControl' class to it. Customize your Pages within the Xcode Attribute Inspector.

Programmatically:
Create a 'LinePageControl' Instance.

The buttons height are equal to the height of the view.

let linePageControl = LinePageControl()

self.view.addSubview(linePageControl)

Additional methods & properties

Public Methods:

linePageControl.set(progress: Int, animated: Bool) // to change the current progress

Public Properties:

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

Delegate:

linePageControl.delegate = self

Delegate protocol:

public protocol LinePageControlDelegate {
func linePageControl(_ linePageControl: LinePageControl, didPressedOn button: UIButton)
func linePageControl(_ linePageControl: LinePageControl, changeProgress to: Int)
}

Donation

If you like my open source libraries, you can sponsor it! ☺️

paypal

Author

Leon Hoppe, [email protected]

License

Distributed under the MIT license. See LICENSE for more information.