Custom SegmentedControls
pod 'AYSegmentedControls'
github "Aiur3908/AYSegmentedControls"
Add the AYSegmentedControls.swift
file to your project.
- Add UIView
- Set AYSegmentedControls as Custom Class.
- Connect IBOutlet
let segmentedControls = AYSegmentedControls(frame: CGRect(x: 100,
y: 100,
width: 300,
height: 50))
view.addSubview(segmentedControls)
segmentedControls.dataSource = self
segmentedControls.delegate = self
///The number of item that the segmentedControls should display.
func numberOfItem(in segmentedControls: AYSegmentedControls) -> Int
///The string to use as the title of the item.
func segmentedControls(_ segmentedControls: AYSegmentedControls,
titleForItemAt index: Int) -> String
///Called by the segmentedControls when the user selects an item.
func segmentedControls(_ segmentedControls: AYSegmentedControls,
didSelectItemAt index: Int)
///HintView background
var hintColor: UIColor
///SegmentedControls border width
var borderWidth: CGFloat
///SegmentedControls border color
var bordrColor: CGFloat
///Content padding
var padding: CGFloat
///Normal status title color
var normalTitleColor: UIColor
///Selected status title color
var selectedTitleColor: UIColor
///Title Font
var titleFont: UIFont
segmentedControls.selectedIndex = 1
or
segmentedControls.selectIndex(at: 2, animated: true)
Jerry You Email: Aiur3908@gmail.com
MIT