This is a custom Segmented Control with icon and text on every segment. DPSegmentedControl is tested on iOS 10.0 This awesome library is wrote on swift 3
let segmentedControl = DPSegmentedControl.init(
FrameWithIcon: CGRect(x: 8, y: 50, width: view.frame.width - 16, height: 44),
items: ["Happy", "Normal", "Sad"],
icons: [UIImage(named: "happy_gray")!, UIImage(named: "flat_gray")!, UIImage(named: "sad_gray")!],
selectedIcons: [UIImage(named: "happy_white")!, UIImage(named: "flat_white")!, UIImage(named: "sad_white")!],
backgroundColor: UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 1),
thumbColor: UIColor.init(hex: "#54C3EF"),
textColor: UIColor(hex: "#808080"),
selectedTextColor: UIColor(hex: "#FFFFFF"),
orientation: ComponentOrientation.LeftRight)
let segmentedControl = DPSegmentedControl.init(
FrameWithoutIcon: CGRect(x: 8, y: 50, width: view.frame.width - 16, height: 44),
items: ["Happy", "Normal", "Sad"],
backgroundColor: UIColor(red: 230/255, green: 230/255, blue: 230/255, alpha: 1),
thumbColor: UIColor.init(hex: "#54C3EF"),
textColor: UIColor(hex: "#808080"),
selectedTextColor: UIColor(hex: "#FFFFFF"))
// To get the changed value event, set it manually on your view controller
segmentedControl.addTarget(self, action: #selector(orderTypeChanged), for: .valueChanged)
// You need to add DPSegmnetedControl to container
self.view.addSubview(segmentedControl)
// You could set the selected index. Default is 0
segmentedControl.selectedIndex = 1
Manual installation. Just copy DPSegmentedControl folder to your project. Will be available on cocoapods soon.
DPSegmentedControl is released under the MIT license. See LICENSE for details.