Marcel Marcel - 10 months ago 103
iOS Question

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.

Answer Source

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.

When setting the UIViewControllers you can also pass the constraints of the buttons that you need to shrink or enlarge and in the viewDidAppear for each UIViewController. You can animate the constraints to do what you require.


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