gmarm / BetterSegmentedControl
- среда, 6 апреля 2016 г. в 03:13:32
Swift
An easy to use, customizable replacement for UISegmentedControl & UISwitch.
BetterSegmentedControl is an easy to use, customizable replacement for UISegmentedControl and UISwitch written in Swift.
BetterSegmentedControl is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'BetterSegmentedControl', '~> 0.2'
If you prefer not to use CocoaPods, you can integrate BetterSegmentedControl into your project manually.
let control = BetterSegmentedControl(
frame: CGRect(x: 0.0, y: 100.0, width: view.bounds.width, height: 44.0),
titles: ["One", "Two", "Three"],
index: 1,
backgroundColor: UIColor(red:0.11, green:0.12, blue:0.13, alpha:1.00),
titleColor: .whiteColor(),
indicatorViewBackgroundColor: UIColor(red:0.55, green:0.26, blue:0.86, alpha:1.00),
selectedTitleColor: .blackColor())
control.titleFont = UIFont(name: "HelveticaNeue", size: 14.0)!
control.addTarget(self, action: #selector(ViewController.controlValueChanged(_:)), forControlEvents: .ValueChanged)
view.addSubview(control)
You can find different ways of using it (such as by designing it in a Storyboard file) in the example project. To run the example project, clone the repo, and run pod install
from the Example directory first.
Feel free fork, submit Pull Requests or send me your feedback and suggestions!
George Marmaridis
BetterSegmentedControl is available under the MIT license. See the LICENSE file for more info.