Search code examples
iosuicollectionviewuialertcontrollernotification-bar

Notification Message/Alert Message and UICollectionView :


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.


Solution

  • 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.