Skip to content
A segmented control in the style of iOS 13 compatible with previous versions of iOS.
Objective-C Other
Branch: master
Clone or download
Latest commit f76e6af Oct 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
Design
TOSegmentedControl
TOSegmentedControlExample.xcodeproj
TOSegmentedControlExample
TOSegmentedControlFramework
TOSegmentedControlTests
buildkite
.gitignore
CHANGELOG.md
CODE_OF_CONDUCT.md
LICENSE
Package.swift
README.md
TOSegmentedControl.podspec
screenshot.jpg

README.md

TOSegmentedControl

TOSegmentedControl

Build status Version Carthage compatible GitHub license Platform PayPal Twitch

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.

Features

  • Recreates the new look of UISegmentedControl, making it available on previous versions of iOS.
  • Supports both text and images as segment types.
  • Support for @IBDesignable and @IBInspectable.
  • Configurable to dynamically add or remove items after its creation.
  • Written in Objective-C, but provides full compatibility with Swift.
  • Provides both a block, or UIControlEvents to receive when the control is tapped.
  • Light and dark mode support for iOS 13.
  • A reversible mode where tapping the same item twice flips its direction.

Sample Code

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!")
}

System Requirements

iOS 10.0 or above

Installation

CocoaPods

Add the following to your Podfile:

pod 'TOSegmentedControl'
Carthage
  1. Add the following to your Cartfile:
github "TimOliver/TOSegmentedControl"
  1. Run carthage update

  2. From the Carthage/Build folder, import the TOSegmentedControl.framework.

  3. Follow the remaining steps on Getting Started with Carthage to finish integrating the framework.

Manual Installation

All of the necessary source files located in the TOSegmentedControl folder. Simply drag that folder into your Xcode project.

Credits

TOSegmentedControl was created by Tim Oliver as a component for iComics.

iOS device mockup by Pixeden.

License

TOSegmentedControl is available under the MIT license. Please see the LICENSE file for more information. analytics

You can’t perform that action at this time.