I have a UITableView with Headers and Rows. When the Rows scroll up into the Header section it looks like they scroll behind the Header. This is fine except I want both my Header and Rows to have non opaque alpha. The design is translucent. When this is the case you can see the Row scroll behind the Header which is bad. Ideally the row just disappears when it scrolls into the Header section.
Anyone have a solution that will still allow me to use translucent Headers? Thanks!
I had the same issue.
If you only have one header the easy solution I did was to just take the header label out of the tableview and put it in the parent view of the uitableview and just shift the uitableview to compensate for the new header view. Now make the header view transparent and the rows don't scroll behind the header view because it is in a different. The downside is that when you scroll up the header doesn't float above the next cell and obviously it doesn't work for multiple headers. Hope this helps.
Related
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.
I am working on Table View. I have implemented Header at the top of TableView. Its scrolling when i scroll TableView. Any Solution to make the Header Static.
If you want a static header, it means that it should not be a header. The behaviour of a header is to scroll with the UITableView.
You can replace it with an UIView placed above your UITableView.
Also, you can use the UITableView.headerView (UIView?), this is a view placed at the top end of the whole tableView and not per section as the sectionHeaderView.
You can simply add UIView On top of UITableView.
Like this :
And result will be:
I know if set the tableView's type to "Plain" , the section header will automatically anchor on the top of the tableView. but if I have multi sections in the tableView. When the tableView scroll to the next section ,the first section's header will disappear. I hope the first section's header can always anchor on the tableView's top whatever I scroll the tableview to any section. is there any way to do that?
What you describe does not happen for UITableViewStyleGrouped but for UITableViewStylePlain.
I can't really think of any easy way to do what you want - I suspect you'll have to insert your own subview and manage its position according to the table's scrolling position.
I found this article which might have some good ideas for what you're trying to do.
I am developing a table view where the header of the first section of a needs to be fixed at point.
I have set table view style as Plain. The section header is now fixed upto the point where the user scrolls in section 0. As soon as section 1 appears the header also scrolls up. Is there any way that the header of section 0 should always be fixed to the top?
Thanks in advance!
You should add UIView which looks like header and it will be at fix top position and after that view add tableview so when you scroll your UIView will not affected and remains at same position. So, you can manage your stuff like this!
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.