Navigation Buttons + UICollectionview on same controller?
-
20-12-2019 - |
Question
I'm newbie with iOS and asking for direction.
I want to make a page which contains navigation buttons on top and when tap load different UICollectionView
's as you can see on the app screen taken from "Fancy". Also buttons line have to be fixed on top while scrolling down. (just like in the screenshot)
Which is the right approach?
- Base class to be
UICollectionViewController
and adding as SubView - Using UIScrollViewController?
etc...
Thanks in advance.
Solution
Base class should be UiViewController
implementing UICollectionViewDelegate
UIViewController <UICollectionViewDataSource,UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
Create different NSArray
for each Category of your project as datasource of UICollectionView
use UISegmentedControl
for switching the datasource of UICollectionView
and reload UICollectionView
to display different content.
You can customise your Segmented Control
as you wanted.
Implement UITabbarController
for the bottom bar to enter any other views
OTHER TIPS
There are a number of ways to go about this. The simplest would probably be to use a UIViewController
subclass whose view
contains a UISegmentedControl
subview (for the navigation controls) and a UICollectionView
subview for the content.