Snapchat like buttons over different view controll

2020-06-23 09:57发布

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.

3条回答
Explosion°爆炸
2楼-- · 2020-06-23 10:14

For complex animations you can achieve this by creating custom transition between view controller. Important to note is that in the transition logic you have to animate controller in such way that substitution of buttons will not be visible. Just when the first controller buttons have disappeared under them will be the second controller buttons.

查看更多
别忘想泡老子
3楼-- · 2020-06-23 10:15

What I did for this was a scrollview with viewcontrollers within it. There are tutorials on youtube just search for snapchat scroll or snapchat menu system or w/e. Then I put the buttons on the scrollview, so as you slide to each view controller the buttons stay stationary. I also made a slider but it becomes pretty complicated. My slider is also disappearing when i navigate out and back, so there is a LOT of tweaking involved.

查看更多
Explosion°爆炸
4楼-- · 2020-06-23 10:21

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

查看更多
登录 后发表回答