Skip to content

RabbitJohn/TTSegmentedControl

 
 

Repository files navigation

TTSegmentedControl

An elegant, animated and customizable segmented control for iOS.

Features:

  • Variable number of items
  • Animated transition
  • Fully configurable (color, gradient, shadow, corner radius)
  • Designable into Interface Builder

Requirements

  • iOS 8.0+
  • Xcode 7.3+

Installation

CocoaPods

Swift 3.0

pod 'TTSegmentedControl'

Swift 2.x

pod 'TTSegmentedControl', '0.1.1'

Manually

Add the TTSegmentedControl.swift file to your project.

Usage

  • Programatic:
let segmentedControl = TTSegmentedControl()
segmentedControl.allowChangeThumbWidth = false
segmentedControl.frame = CGRect(x: 50, y: 200, width: 100, height: 50)
segmentedControl.didSelectItemWith = { (index, title) -> () in
    print("Selected item \(index)")
}
view.addSubview(segmentedControl)
  • Interface Builder:

Add a UIView and set it's class to TTSegmentedControl. You can customize the control directly from the interface builder.

How to customize?

Checkout the playground and see how to implement and customize the SegmentedControl.

pod try TTSegmentedControl

In order to customize the segmented control you'll have to edit it's properties.

segmentedControl.defaultTextColor = UIColor.blackColor()
segmentedControl.selectedTextColor = UIColor.whiteColor()
segmentedControl.thumbGradientColors = [UIColor.redColor(), UIColor.blueColor()]
segmentedControl.useShadow = true

Contribution

Feel free to Fork, submit Pull Requests or send us your feedback and suggestions!

License

TTSegmentedControl is available under the MIT license. See the LICENSE file for more info.

About

An elegant, animated and customizable segmented control for iOS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.1%
  • Ruby 0.9%