As part of the visual improvements featured in iOS 13, UISegmentedControl
was completely redesigned, featuring a much rounder, cleaner, and slightly more skeuomorphic appearance.
TOSegmentedControl
is a subclass of of UIControl
that completely re-implements the look and feel of the new UISegmentedControl
component, allowing developers to adopt its look even in previous versions of iOS they support.
UISegmentedControl
, making it available on previous versions of iOS.@IBDesignable
and @IBInspectable
.UIControlEvents
to receive when the control is tapped.TOSegmentedControl
has been written to follow the interface of UISegmentedControl
as closely as possible. This should make it very intuitive to work with.
let segmentedControl = SegmentedControl(items: ["First", "Second", "Third"])
segmentedControlsegmentTappedHandler = { segmentIndex, reversed in
print("Segment \(segmentIndex) was tapped!")
}
iOS 10.0 or above
Add the following to your Podfile:
pod 'TOSegmentedControl'
Add the following to your Cartfile:
github "TimOliver/TOSegmentedControl"
Run carthage update
From the Carthage/Build
folder, import the TOSegmentedControl.framework
.
Follow the remaining steps on Getting Started with Carthage to finish integrating the framework.
All of the necessary source files located in the TOSegmentedControl
folder. Simply drag that folder into your Xcode project.
TOSegmentedControl
was created by Tim Oliver as a component for iComics.
iOS device mockup by Pixeden.
TOSegmentedControl
is available under the MIT license. Please see the LICENSE file for more information.