LXPageControl icon indicating copy to clipboard operation
LXPageControl copied to clipboard

PageControl with lines

LXPageControl

Xcode 9.0+ iOS 9.0+ Swift 4.0+ CocoaPods Compatible
Platform License

LXPageControl is a simple PageControl with lines.

Requirements

  • Swift 4+
  • iOS 9.0+
  • Xcode 9+

Installation

CocoaPods

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

pod 'LXPageControl'

Usage

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

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

Programmatically:
Create a 'LXPageControl' Instance.

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

let pageControl = LXPageControl()

self.view.addSubview(pageControl)

Additional methods & properties

Public Methods:

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

Public Properties:

pageControl.leftBtn: UIButton // button to decrease progress
pageControl.rightBtn: UIButton // button to increase progress
pageControl.pages: Int // count of Pages
pageControl.elementWidth: CGFloat // width of an element
pageControl.elementHeight: CGFloat // height of an element
pageControl.spacing: CGFloat // spacing between elements
pageControl.inactiveColor: UIColor // color of inactive elements
pageControl.activeColor: UIColor // color of active element
pageControl.cornerRadius: CGLoat // corner radius of the elements
pageControl.fillWidthAutomatically: Bool // determines automatically the width of each element and fill the entire view width depending on the spacing

Delegate:

pageControl.delegate = self

Delegate protocol:

public protocol LXPageControlDelegate {
func pageControl(_ pageControl: LXPageControl, didPressedOn button: UIButton)
func pageControl(_ pageControl: LXPageControl, 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.