滚动时更改视图大小
我有一个滚动视图,其中有几个视图。我希望显示的视图使得滚动视图中间的视图的尺寸最大,而其他视图的尺寸从中间到末端不断减小。此外,当视图滚动时,应调整视图大小以遵循此行为。我该如何开始呢?
I have a scroll view with a couple of views in it. I want the views to be displayed such that the size of the view in the middle of the scrollview is the largest and the size of the other views keep decreasing from the middle to the ends. Also, when the view is scrolled, the views should be resized to follow this behavior. How do I start about with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试让视图控制器适应 UIScrollViewDelegate 协议,然后使用 scrollViewDidScrollFunction。
在该函数内,您可以检查滚动视图的内容偏移量并相应地调整图像大小。比如:
干杯
You could try having your view controller adapt the UIScrollViewDelegate protocol and then use the scrollViewDidScrollFunction.
Inside the function you can check the content offset of your scrollview and resize your images accordingly. Something like:
Cheers