List with fixed header bounce effect like App Store - ios

I want to make a UITableView with a fixed header, like the App Store, with the bounce effect below the header:
I've tried a UIScrollView with a UITableView with scrollEnabled NO. Didn't work; it didn't make the bounce effect below the header:
My View:

I finally found one solution.
Basically I created a UITableView and a header, both with clear background color. Then I add a new view (with the same height that the header tableView has), between the controller view and tableView, positioned at the top. This new view is the header.
I then use the function scrollViewDidScroll to manage the position of the view that simulates the header.
This way I could achieve the bounce in the tableView below the header
I have made an example, you can download it here

Related

How to make header only stick on negative content offset - Swift

I have a tableView and I have a UIView as the tableView header. I want the header to move up the screen when I scroll down and act just like any normal cell. But when I have reached the top of the view, where if I scroll up it will just bounce back, I want the tableView header to stick to the top.
One example is like the Facebook app headers. They scroll when you scroll, but if you're at the top of the page and you scroll up, they wont scroll down, they stay stuck to the top.
How do I achieve this?
If you're using a normal tableView (not grouped style) and you only have one section, you can accomplish this by using the section header instead. The default behaviour of this type of tableView is as you described. You'll just have to provide a custom view for the section header that looks like your cell.
If this isn't a possibility, you'll need to take advantage of tableView being a subclass of scrollView, and implement the scrollViewDidScroll delegate method to check content offsets etc.

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. ( 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
This is done with a combination of various scroll views and table views.
It looks like the whole screen is contained in a UIScrollView. The "header" is just a UILabel that moves depending on the content offset of the scroll view.
The time bar with "Now", "02", "03", ... Is probably a UICollectionView inside the main UIScrollView.
The section underneath that is a UITableView with all the day information. This is also embedded inside the UIScrollView.
The scrolling is then managed by the main UIScrollView and passed down to the UITableView.
However, when the tableview scrolls it is not going underneath anything. The content is being cut off because that is the top of the UITableView.
Then the entire thing is also embedded inside a UIPageViewController to manage the pages.
Something like this...

Mixing UIScrollViews and UITableViews

If you look at the Featured tab of the Apple App Store app on an iPhone 6, there is a unique UI layout that I can't figure out how to replicate.
At the very top there is a navigationBar. Below this there is a UIScrollView that animates through a number of featured items. Below this is what appears to be a UITableView with a number of custom programmed cells.
My first guess was that the UIScrollView at the top was added to a custom cell at the top of a UITableView. If you swipe up the UIScrollView moves with the objects below like it is a cell. You can see that the vertical scroll indicator starts at the top of the UIScrollView.
The part that is unique is that if you swipe down, the objects below the UIScrollView move down like a UITableView and the UIScrollView stays in place. This means that the UIScrollView is not a custom cell at the top of a UITableView.
I tried making this work a number of different ways but I can replicate this. Does anyone know how this can be done?
You can use a tableview header,the header is a scrollview
If you scroll tableview up,just use tableview default behavior,the header will scroll up.
If you scroll down,use UIScrollViewDelegate to calculate the tableview header new frame,and adjust it.So it remain at top
Not sure if I got you correctly, you may use UICollectionView as vertical scroll. Then, you create a custom UICollectionViewCell, each with horizontal scroll.
I haven't tried it though but done something similar to this. Hope you find a way!

UITableView with header works incorrectly for any view except UISearchBar

I have standard master-detail navigation based app with first VC as UITableView. I want almost standard UITableView with custom tableHeaderView (UISearchBar enhanced with additional button).
First I have tried to set UISearchBar as header view and everything works just fine.
But when I set a custom view (even simple empty UIView) as tableHeaderView, table begins to behave wrongly:
Header view scroll offset is not adjusted automatically (i.e. header not automatically slides up or down)
When push to another view controller happens, UITableView scrolls to Zero contentOffset, which is noticeable by user
This is strangle because UISearchBar being set as header should not affect tableView scroll logic.
Maybe apple uses some hidden APIs?
Anyway, is there a way to make custom header that works smoothly like with a SeacrBar (without side effects)?

UITableView: anchor section header

I have a UITableView with one section and a header. The problem is that when I scroll down beyond the contents of the table, the header is pulled down along with the cells. I would like it to stay at the top of the view. I tried the suggestion on this post,
Change Default Scrolling Behavior of UITableView Section Header
using the footer of a zero-row section as the header, but it still isn't anchored. Does anyone know how to do this properly?
Are you using a UITableViewController? If you are using a UIViewController that contains a UITableView you could just add a UIView above the UITableView.
You could also add the UIView on top of the UITableView and add an alpha gradient to make it look more similar to a regular UITableView section header.

Resources