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!
Related
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 would like to construct a view controller where one section of the view controller would be still and one section scrollable.
Both sections have headers where as well, one is still and one is moving along with the content in the section.
I do not want the cells in the section to be scrolled separately. All cells should move at the same time along with the header.
I have added an image to make my point little more clearer.
Use UICollection View for both view and disable scrolling for one view and enable scrolling for another view
you can probably add to your UIViewController view a UITableView on the left with fixed size (for example 150px) and vertical scroll disabled and a UICollectionView with horizontal flow and ,if needed a, with custom UICollectionViewLayout (but i think that you just need the classic UICollectionViewFlowLayout) for the right part that fits the remaining space.
Here you can find the component's documentation:
https://developer.apple.com/reference/uikit/uicollectionview
https://developer.apple.com/reference/uikit/uitableview
We know that a plain UITableView will fix its section header view in the top of it. Can we make the section header view not to float in the top of its UITableView, but fix in another position, such as 100 points away from the top of its UITableView?
Any ideals will be appreciated,thanks.
You can add custom view as header to your table view & set the position of tableview from it below 100 points.
Sorry there is no any way to stop it.. But You can do this kind of functionality using the UITableViewCell... take the first cell of section to show section detail and set section height as 0..
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.
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.