All Projects → TimOliver → Tosegmentedcontrol

TimOliver / Tosegmentedcontrol

Licence: mit
A segmented control in the style of iOS 13 compatible with previous versions of iOS.

Projects that are alternatives of or similar to Tosegmentedcontrol

Ttsegmentedcontrol
An elegant, animated and customizable segmented control for iOS created by Tapptitude
Stars: ✭ 471 (+170.69%)
Mutual labels:  cocoapods, uikit
Bfkit
BFKit is a collection of useful classes and categories to develop Apps faster.
Stars: ✭ 811 (+366.09%)
Mutual labels:  cocoapods, uikit
Watchdoginspector
Shows your current framerate (fps) in the status bar of your iOS app
Stars: ✭ 497 (+185.63%)
Mutual labels:  cocoapods, uikit
Acknowlist
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.
Stars: ✭ 392 (+125.29%)
Mutual labels:  cocoapods, uikit
Bfkit Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
Stars: ✭ 963 (+453.45%)
Mutual labels:  cocoapods, uikit
Tweetextfield
Lightweight set of text fields with nice animation and functionality. 🚀 Inspired by https://uimovement.com/ui/2524/input-field-help/
Stars: ✭ 421 (+141.95%)
Mutual labels:  cocoapods, uikit
Statusalert
Display Apple system-like self-hiding status alerts. It is well suited for notifying user without interrupting user flow in iOS-like way.
Stars: ✭ 809 (+364.94%)
Mutual labels:  cocoapods, uikit
Ezswiftextensions
😏 How Swift standard types and classes were supposed to work.
Stars: ✭ 2,911 (+1572.99%)
Mutual labels:  cocoapods, uikit
Weekdayssegmentedcontrol
A Custom segmented control to select weekdays for iOS
Stars: ✭ 14 (-91.95%)
Mutual labels:  cocoapods, uikit
Tkswitchercollection
An animation switch collection
Stars: ✭ 877 (+404.02%)
Mutual labels:  cocoapods, uikit
Tlyshynavbar
Unlike all those arrogant UINavigationBar, this one is shy and humble! Easily create auto-scrolling navigation bars!
Stars: ✭ 3,780 (+2072.41%)
Mutual labels:  cocoapods, uikit
Tkrubberindicator
A rubber animation pagecontrol
Stars: ✭ 1,337 (+668.39%)
Mutual labels:  cocoapods, uikit
Stepslider
StepSlider its custom implementation of slider such as UISlider for preset integer values.
Stars: ✭ 391 (+124.71%)
Mutual labels:  cocoapods, uikit
Hokusai
A Swift library to provide a bouncy action sheet
Stars: ✭ 431 (+147.7%)
Mutual labels:  cocoapods, uikit
Shadowview
An iOS Library that makes shadows management easy on UIView.
Stars: ✭ 391 (+124.71%)
Mutual labels:  cocoapods, uikit
Cyltabbarcontroller
[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
Stars: ✭ 6,605 (+3695.98%)
Mutual labels:  cocoapods, uikit
Cltypinglabel
iOS UILabel with character by character typing /typewriter animation
Stars: ✭ 192 (+10.34%)
Mutual labels:  cocoapods, uikit
Alertift
Swifty, modern UIAlertController wrapper.
Stars: ✭ 242 (+39.08%)
Mutual labels:  cocoapods, uikit
Vtacknowledgementsviewcontroller
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies.
Stars: ✭ 863 (+395.98%)
Mutual labels:  cocoapods, uikit
Dtgradientbutton
Easy way to set gradient background to your buttons.
Stars: ✭ 76 (-56.32%)
Mutual labels:  cocoapods, uikit

TOSegmentedControl

TOSegmentedControl

CI 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.

Swift

In Swift, the class is renamed to SegmentedControl. Creating a new instance is very similar to UISegmentedControl.


// Create a new instance
let segmentedControl = SegmentedControl(items: ["First", "Second", "Third"])

// Add a closure that will be called each time the selected segment changes
segmentedControlsegmentTappedHandler = { segmentIndex, reversed in
   print("Segment \(segmentIndex) was tapped!")
}

// Add a new item to the end
segmentedControl.addSegment(withTitle: "Fourth")

// Insert a new item at the beginning
segmentedControl.insertSegment(withTitle: "Zero", at: 0)

// Remove all segments
segmentedControl.removeAllSegments()

Objective-C

NSArray *items = @[@"First", @"Second", @"Third"];

// Create a new instance
TOSegmentedControl *segmentedControl = [[TOSegmentedControl alloc] initWithItems:items]];

// Add a block that will be called each time the selected segment changes
segmentedControl.segmentTappedHandler = ^(NSInteger index, BOOL reversed) {
    NSLog(@"Segment %d was tapped!", index);
};

// Add a new item to the end
[segmentedControl addSegmentWithTitle:@"Fourth"];

// Insert a new item at the beginning
[segmentedControl insertSegmentWithTitle:@"Zero" atIndex:0];

// Remove all segments
[segmentedControl removeAllSegments];

System Requirements

iOS 9.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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].