简体   繁体   English

像天气一样制作透明的stickyHeader iOS

[英]make transparent stickyHeader like weather iOS

i want to create transparent sticky header like weather app in iOS as my header is transparent view goes under header but i don't want other content visible bellow my header.我想在 iOS 中创建像天气应用程序一样的透明粘性标题,因为我的标题是透明的, view位于标题下方,但我不希望其他内容在我的标题下方可见。 ( you can see "Friday" goes under header and will hidden but the header is transparent). (您可以看到“星期五”位于标题下方并将隐藏,但标题是透明的)。 you can check the animation and this behavior in weather app.您可以在天气应用程序中检查动画和此行为。

在此处输入图片说明

i have tried :我试过了 :

CSStickyHeader CSStickyHeader

This is done with a combination of various scroll views and table views.这是通过各种滚动视图和表格视图的组合来完成的。

It looks like the whole screen is contained in a UIScrollView .看起来整个屏幕都包含在UIScrollView The "header" is just a UILabel that moves depending on the content offset of the scroll view. “标题”只是一个 UILabel,它根据滚动视图的内容偏移量移动。

The time bar with "Now", "02", "03", ... Is probably a UICollectionView inside the main UIScrollView .带有 "Now", "02", "03", ... 的时间栏可能是主UIScrollView内的UICollectionView

The section underneath that is a UITableView with all the day information.下面的部分是一个包含全天信息的UITableView This is also embedded inside the UIScrollView .这也嵌入在UIScrollView

The scrolling is then managed by the main UIScrollView and passed down to the UITableView .然后滚动由主UIScrollView管理并传递给UITableView

However, when the tableview scrolls it is not going underneath anything.但是,当 tableview 滚动时,它不会在任何东西下面。 The content is being cut off because that is the top of the UITableView .内容被截断,因为那是UITableView的顶部。

Then the entire thing is also embedded inside a UIPageViewController to manage the pages.然后整个东西也嵌入在UIPageViewController来管理页面。

Something like this...像这样的东西...

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM