像 Google 一样根据 UIScrollView 中的页面旋转 UILabels应用程序
我有一个应用程序,在 UIScrollView 中有几个 (8) 不同的视图。它们在盘旋,这样当你试图“落后”到最后一个时,你就能到达第一个,反之亦然。 我的问题是如何创建像 Google+ 应用程序的 Stream 中那样的标题栏。标题随页面盘旋并显示当前可见页面。 我怎么能意识到这一点呢?是否可以创建一个通用类来在许多不同的应用程序中使用此类视图?
我已经尝试用一些不同的方法来解决这个问题,但它们都不起作用(很好)。我可以在滚动视图上方显示标签并移动它们,但是移动多远以及使用哪些文本对我来说似乎很困难。
所以现在我期待着你的答案;D
I have an application with several (8) different Views in a UIScrollView. They are circling so that you get to the first when you try to get "behind" the last and vice versa.
My problem is how to create a titlebar like in the Stream of the Google+ App. There the titles are circling with the pages and show the current visible page.
How could I realize that? Would it be possible to create a general class to use such a view in many different apps?
I've already tried to solve this problem with some different approaches, but they all didn't work (well). I can display labels above my scrollView and move them, but how far and with which text seems to be difficult for me.
So now I'm looking forward to your answers ;D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用两个
UIScrollView
,一个用于内容,一个用于标题。标题UIScrollView
将由视图控制器控制,该视图控制器也是主UIScrollView
的委托。每当您从主UIScrollView
收到-scrollViewDidScroll:
消息时,请更新标头UIScrollView
。Try using two
UIScrollView
, one for the content and one for the headers. The headerUIScrollView
would be controlled by your view controller that is also a delegate of the mainUIScrollView
. Update the headerUIScrollView
whenever you receive a-scrollViewDidScroll:
message from the mainUIScrollView
.我认为您需要在自定义视图中添加标签,然后在滚动视图中添加自定义视图,您将获得单个视图的事件,因此您可以根据角度旋转该视图并将标签保持在固定位置...
I think you need to add label in customview and then add customviews in scrollView, you will get events for individual view, so you can rotate that view according to angle and keep label at fix place...