Notification Message/Alert Message and UICollectionView :

277 Views Asked by At

I have a Navigation Bar, a Search Bar, and below, a Collection View.

My first question : I'd like to have a custom notification bar (alert message ?) that would appear right below my Search Bar, over my Collection View, only the first time I launch my app, with the possibility for the user to close it, like so :

Notification Message/Bar appears over the Collection View

I tried to use UIAlertControllers but obviously it's not gonna make it.

My second question :

Also, how could I manage to get the same Notification Bar/Message, but, this time, instead of placing it over my Collection View, I am trying to find a way to push down my Collection View Cells as my Notification Bar appears (animation?) to create an effect like that :

Collection View pushed down by the Notification Message/Bar

Thank you very much for your help !

Have a nice day,

J.

2

There are 2 best solutions below

5
Mahesh Agrawal On BEST ANSWER

You can achieve this by using UICollectionReusableView. You just need to change the height of the header according to your requirement.

here is a sample project i have made for your reference. you can run it and try.

https://[email protected]/mahesh-agrawal/collection-popup-test.git

dropbox link - https://www.dropbox.com/s/j247mfshzld2tuj/collection-popup-test.zip?dl=0

check it.

1
Nguyen Hoan On

The first question:
You can add a custom view(your custom notification bar) on top Window .

The second question:
You add custom view above your collectionview, and create outlet for height constraint of this customview.
If have notification, you set heightconstraint # 0 and set = 0 when not (with animation)