AirSegmentedControl
open class AirSegmentedControl: UIControl
Custom UIControl subclass
-
Convenience for
@IBInspectablesettings segment titlesDeclaration
Swift
@IBInspectable open var commaSeparatedSegments: String = "" -
Controls how quickly the underline moves between sections.
valueChangedis always sent immediately.Declaration
Swift
@IBInspectable open var animationTime: Double = 0.2 -
When
true, only sends avalueChangedwhen 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
Segmentwhich are being displayedDeclaration
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
segmentsArray of segments to display
styleOptional style configuration, if
nil -
Select an index, sending a
valueChangedevent.Declaration
Swift
open func select(at index: Int, animated: Bool = true)Parameters
indexIndex to select
animatedShould the selection be animated,
AirSegmentedControl Class Reference