MainViewController
class MainViewController : UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout
MainViewConroller set up other view controllers
-
This is a
UIViewthat is placed on the TabBarDeclaration
Swift
@IBOutlet var tabBarView: TabBarView! -
This is a
UICollectionViewthat is used to save an ordered collection ofviewControllersand present them using customizable layoutsDeclaration
Swift
@IBOutlet var collectionView: UICollectionView! -
This is a variable to save a list of
UIViewsDeclaration
Swift
var views: [UIView] -
List of
ViewcontrollersDeclaration
Swift
var viewControllers: [UIViewController?]
-
Customise View
- Setup CollectionView
- Setup TabbarView
- Init ViewControllers
- Setup Notification Centre
Declaration
Swift
func customisation() -
Scroll the menu, this will be called when a notification is being sent with value didSelectMenu
Declaration
Swift
@objc func scrollViews(notification: Notification) -
Hide the navigation bar, this will be called when a notification is being sent with value hide
Declaration
Swift
@objc func hideBar(notification: NSNotification)
-
Asks collectionView for the number of items in the specified section.
Declaration
Swift
func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> IntParameters
collectionViewThe collection view requesting this information.
sectionAn index number identifying a section in collectionView. This index value is 0-based.
Return Value
The number of rows in section.
-
Asks collectionView for the cell that corresponds to the specified item in the collection view.
Declaration
Swift
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCellParameters
collectionViewThe collection view requesting this information.
indexPathThe 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) -> CGSizeParameters
collectionViewThe collection view object displaying the flow layout.
indexPathThe index path of the item
collectionViewLayoutThe layout object requesting the
Return Value
The width and height of the specified item. Both values must be greater than 0.
-
Tells the delegate when the user scrolls the content view within the receiver.
Declaration
Swift
func scrollViewDidScroll(_ scrollView: UIScrollView)Parameters
scorllViewThe scroll-view object in which the scrolling occurred.
-
Called after the controller's view is loaded into memory. Load
customisationDeclaration
Swift
override func viewDidLoad() -
Deinitialization Function
Declaration
Swift
deinit
MainViewController Class Reference