Snapchat喜欢不同视图控制器上的按钮 [英] Snapchat like buttons over different view controllers
问题描述
3个主要的Snapchat按钮位于屏幕的底部,但是当您在不同的视图控制器之间滑动和移动时,它们会保持在相同的位置。不仅如此,它们还会根据您所处的视图缩小和增长。
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.
我正在尝试做类似的事情。我在我的vc顶部有一个按钮,当我转到另一个按钮时,我希望它保持在那里仍然可以正常工作。
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.
推荐答案
一种可能的方法是使用 UIPageViewController
并将其设置为显示所需的 UIViewControllers
在适当的索引处。在继承 UIPageViewController
之后,您必须以编程方式添加按钮。
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
.
或者:
您还可以使用 UICollectionView
使用全屏大小的单元格,并在 UICollectionViewCell.contentView $内的正确索引处添加所需的
UIViewController.view
C $ C>。添加 UICollectionView
顶部的按钮,并通过基于 scrollView
<$增加或减少约束来设置按钮动画。 c $ c> contentOffset
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
这篇关于Snapchat喜欢不同视图控制器上的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!