RESegmentedControl
open class RESegmentedControl : UIControl
Segmeted Control
-
Preset that applied to style Segmented control and it’s child views
Declaration
Swift
public var preset: SegmentedControlPresettable { get set }
-
Segment items, models that will be used inside segments
Should be added in configure method
Declaration
Swift
var segmentItems: [SegmentModel]
-
Selected segment index
Declaration
Swift
public var selectedSegmentIndex: Int { get set }
-
Initializes segmented control with a specified frame, segment item’s models and styles.
Used during code-layout implementation. Use
configure
method if you implement UI using storyboard.Declaration
Swift
public init(frame: CGRect, segmentItems: [SegmentModel], preset: SegmentedControlPresettable = BootstapPreset(), selectedIndex: Int = 0)
Parameters
frame
Frame
segmentItems
Segment item models
preset
Style preset
selectedIndex
selected index (optional)
-
Configures the segment items and styles.
Declaration
Swift
public func configure(segmentItems: [SegmentModel], preset: SegmentedControlPresettable = BootstapPreset(), selectedIndex: Int = 0)
Parameters
segmentItems
Segment item models
preset
Style preset
selectedIndex
Selected index (optional)
-
Undocumented
Declaration
Swift
public override init(frame: CGRect)
-
Undocumented
Declaration
Swift
public required init?(coder aDecoder: NSCoder)
-
Undocumented
Declaration
Swift
open override func layoutSubviews()
-
Updates views layouts.
Layout-Driven UI 😎
Declaration
Swift
func updateLayouts()
-
Undocumented
Declaration
Swift
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
-
Undocumented
Declaration
Swift
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
-
Undocumented
Declaration
Swift
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)
-
Undocumented
Declaration
Swift
public func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool
-
Segment items count
Declaration
Swift
public var segmentItemsCount: Int { get }
-
Adds new segment item with the specified model
Declaration
Swift
public func addItem(_ item: SegmentModel, atIndex index: Int? = nil)
Parameters
item
Segment item model
index
Index where should be added (optional)
-
Removes segment item
Declaration
Swift
public func removeItem(atIndex index: Int? = nil)
Parameters
index
Index where should be removed (optional)
-
Clears images cache, that was downloaded from a remote server
Declaration
Swift
public func clearCache()
-
Deselect selected segment item
Declaration
Swift
public func deselect()