Search code examples
iosswiftuibuttonsnapchat

Snapchat like buttons over different view controllers


The 3 main snapchat buttons are on the bottom on the screen, but as you swipe and move between different view controllers, they stay in the same position. Not only that, they also shrink and grow depending on which view you are in.

snapchat buttons

I'm trying to do something similar. I have a button at the top of my vc, and when I segue to another one I would like it to stay it there and still be functional.


Solution

  • One possible way of going about this would be using a UIPageViewController and setting it up to show the required UIViewControllers at the appropriate indexes. You will have to programmatically add the buttons after subclassing the UIPageViewController.

    Alternatively:

    You can also use UICollectionView with full screen size cells and add the required UIViewController.view at the proper indexes inside the UICollectionViewCell.contentView. Add the buttons on top of the UICollectionView and animate the button by increasing or decreasing the constraints based on the scrollView contentOffset