---
title: "#226: BetterSegmentedControl 🛠"
url: https://littlebitesofcocoa.com/226-bettersegmentedcontrol
author: Jake Marsh
published: 2016-04-04
topics: ["Libraries","UIKit"]
description: "UISegmentedControl is great, but it's not animated, and has limits to how much you can customize it. UISwitch is great too, it is animated, but it's limited..."
---

# #226: BetterSegmentedControl 🛠

By Jake Marsh, April 4, 2016. HTML: https://littlebitesofcocoa.com/226-bettersegmentedcontrol

**UISegmentedControl** is great, but it's not animated, and has limits to how much you can customize it. **UISwitch** is great too, it is animated, but it's limited to a yes/no choice, and customization again can be quite tricky. Today we'll look at a library from [George Marmaridis](https://github.com/gmarm) called [BetterSegmentedControl](https://github.com/gmarm/BetterSegmentedControl) that aims to helps us here.

Let's try it out in a navigation bar:

``` swift
let c = BetterSegmentedControl(titles: ["Lights On", "Lights Off"])

c.frame = CGRect(x: 35.0, y: 40.0, width: 200.0, height: 30.0)
c.cornerRadius = 3.0
c.titleFont = UIFont(name: "Avenir", size: 13.0)
c.backgroundColor = .darkGrayColor()
c.titleColor = .lightGrayColor()
c.selectedTitleColor = .whiteColor()
c.bouncesOnChange = false

navigationItem.titleView = c
```

<img src="https://camo.githubusercontent.com/5a35efc4c67e0908674ccf83531a57bac3761044/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f336f475246784145616f41416a716e5a36672f67697068792e676966" style="max-width: 375px;" />

Awesome! More info about _BetterSegmentedControl_ can be found at [git.io/bsc](git.io/bsc)
