AirSegmentedControl

open class AirSegmentedControl: UIControl

Custom UIControl subclass

  • Convenience for @IBInspectable settings segment titles

    Declaration

    Swift

    @IBInspectable open var commaSeparatedSegments: String = ""
  • Controls how quickly the underline moves between sections. valueChanged is always sent immediately.

    Declaration

    Swift

    @IBInspectable open var animationTime: Double = 0.2
  • When true, only sends a valueChanged when the value changes to something different.

    Declaration

    Swift

    @IBInspectable open var shouldIgnoreDuplicateInputs: Bool = true
  • The color of the underline

    Declaration

    Swift

    @IBInspectable open var underlineColor: UIColor = .darkGray
  • The height of the underline

    Declaration

    Swift

    @IBInspectable open var underlineHeight: Int = 2
  • The color of the segment text when selected

    Declaration

    Swift

    @IBInspectable open var textColorSelected: UIColor = .black
  • The text color of all unselected segments

    Declaration

    Swift

    @IBInspectable open var textColorUnselected: UIColor = .darkGray
  • Font

    Declaration

    Swift

    @IBInspectable open var textFont: UIFont = UIFont.systemFont(ofSize: 16)
  • Whether to show a bottom border

    Declaration

    Swift

    @IBInspectable open var bottomBorderVisible: Bool = false
  • The color of the bottom border, if it’s visible

    Declaration

    Swift

    @IBInspectable open var bottomBorderColor: UIColor = .lightGray
  • The height of the bottom border

    Declaration

    Swift

    @IBInspectable open var bottomBorderHeight: Int = 1
  • Array of Segment which are being displayed

    Declaration

    Swift

    open fileprivate(set) var segments: [String] = []
  • Get the currently selected segment index

    Declaration

    Swift

    open fileprivate(set) var selectedSegmentIndex: Int = 0
  • Calls setupView()

    Declaration

    Swift

    override open func awakeFromNib()
  • Calls setupView()

    Declaration

    Swift

    required public init?(coder aDecoder: NSCoder)
  • Calls setupView()

    Declaration

    Swift

    override public init(frame: CGRect)
  • Configure the control with provided segments and style

    Declaration

    Swift

    open func configure(with segments: [Segment])

    Parameters

    segments

    Array of segments to display

    style

    Optional style configuration, if nil

  • Select an index, sending a valueChanged event.

    Declaration

    Swift

    open func select(at index: Int, animated: Bool = true)

    Parameters

    index

    Index to select

    animated

    Should the selection be animated,