TabBarView

class TabBarView : UIView, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource, UICollectionViewDelegate

Set up tab bar view

Properties

  • This is a UICollcetionViewwhich is used to save an ordered collection

    Declaration

    Swift

    @IBOutlet
    var collectionView: UICollectionView!
  • This is a UIView which is used as a whiteBar under the selected icon

    Declaration

    Swift

    @IBOutlet
    var whiteBar: UIView!
  • This a NSLayoutConstrait which is used to size the whiteBar

    Declaration

    Swift

    @IBOutlet
    var whiteBarLeadingConstraint: NSLayoutConstraint!
  • This variable is used to save the selected cell in UICollectionView

    Declaration

    Swift

    var selectedIndex: Int

Methods

Delegates

  • Asks tabBarImages for the number of items in the specified section.

    Declaration

    Swift

    func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int

    Parameters

    collectionView

    The collection view requesting this information.

    section

    An index number identifying a section in collectionView. This index value is 0-based.

    Return Value

    The number of rows in section.

  • Asks tabBarImages for the cell that corresponds to the specified item in the collection view.

    Declaration

    Swift

    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell

    Parameters

    collectionView

    The collection view requesting this information.

    indexPath

    The index path that specifies the location of the item.

    Return Value

    A configured cell object. You must not return nil from this method.

  • Asks the delegate for the size of the specified item’s cell.

    Declaration

    Swift

    func collectionView(_: UICollectionView, layout _: UICollectionViewLayout, sizeForItemAt _: IndexPath) -> CGSize

    Parameters

    collectionView

    The collection view object displaying the flow layout.

    indexPath

    The index path of the item

    collectionViewLayout

    The layout object requesting the

    Return Value

    The width and height of the specified item. Both values must be greater than 0.

  • Tells the delegate that the item at the specified index path was selected.

    Declaration

    Swift

    func collectionView(_: UICollectionView, didSelectItemAt indexPath: IndexPath)

    Parameters

    collectionView

    The collection view object displaying the flow layout.

    indexPath

    The index path of the item

View LifeCycle

  • Called after the controller'€™s view is loaded into memory. Load customisation Method

    Declaration

    Swift

    override func awakeFromNib()
  • Deinitialization Function

    Declaration

    Swift

    deinit