Tableview Cells Dequeing Prematurely after change in tableview height constraint - ios

I've designed the screen to remove some views as the user scrolls down. This will also trigger an increase in height of the tableview covering for the "removed" views.
The problem is, when i scroll up, cells deque and disappear on the top edge of the old tableview height. This creates this blank gap since it deques prematurely.
How do I fix it so that it deques using the NEW top edge of the tableview?

Related

IOS Swift TableView: Is there a way to move first cell one row down

I'm trying to make a fullscreen tableView but also have some space at the top when the viewcontroller first appears for a searchbar which disappears when you scroll the tableView, right now I'm hacking it by making an invisible cell at top, however is there a way for it to do so that only when you first load the viewcontroller, the first cell is about one row lower but can still scroll up to reach the full height of the viewcontroller, so the top of viewcontroller when you scroll back to top?
This is what I have right now:
The issue I'm having right now is that the invisible cell creates a huge empty space when u scroll down, see below:
As I understand you don't want the search bar to stick at the top of your view, so it must be in one of the tableView Cells, if this is true if you want to have an empty space under the search bar you can have another custom cell which you can customize its height in tableView(_:heightForRowAt) function.

Stop UITableView's tableHeaderView from autoscrolling

I have a pretty large view being used as my tableHeaderView (not a section header) for a UITableView. When scrolling, it seems that the table view must display either the entire tableHeaderView or none of it. If I scroll down just a bit, the table view scrolls back to the top of the header view when I release. If I scroll down just over halfway down the tableHeaderView, the table view scrolls down farther to hide the entire tableHeaderView when I release.
This is causing very jumpy scrolling for the user. Is there any way to disable this so that you can scroll down the tableHeaderView partially.
To clarify, this is not a question about making the tableHeaderView float. I want the header view to scroll with the table view, I just don't want this jumpy scrolling behavior.

Update tableview content frame origin

I am changing the y origin of a UIView in the first visible cell on the viewdidscroll event.
I update the position of the cell's content at every scroll so that it doesn't visually move with the cell.
When a previous cell is not visible anymore(scroll down), I cannot see the view anymore if I scroll up.
My question : How does scrolling affect the frame the of the views inside the cells ? How can I fix my problem ? (Will post code soon)
Cells get reused. When a cell scrolls off the screen it is reused for another cell scrolling into view. So you need to reset any views of the cell when it get reused.
If you have a custom cell, the prepareForReuse method should be overridden to reset any appropriate state.

Have a UITableView extend its footer beyond its height?

I have a UITableView at the bottom of the screen that pulls up and then snaps back down. When it is pulled up, though, you can see the view behind it because the tableview's height is finite and less than the size of the screen.
I tried using a large footer, but that affects the snap-back of scrolling the table up.
I also tried setting a fixed height for heightForFooter and returning a large view from viewForFooterInSection, but that view gets cut off after it reaches the height returned by heightForFooter
How can I display fixed content beneath my table without affecting its scrolling?
Add a background view to your table view, and then add a subview to that view with the color you need. You can position the subview around table/section headers.
In viewDidScroll, update the y position and height of the subview.

UITableView: scrolling outside bounds hides cells

I have an UITableView that does not fill the whole screen, so there is some space at the top and the bottom of the screen. This table uses table.clipToBounds = NO and table.bounces = YES.
But when scrolling the cells outside the original frame of the table, the cells are hidden. I know that's the normal behavior of UITableView to increase performance. But is it possible to define an area at the top/bottom of UITableView within which the cells are not hidden? Or even set a cell property to be "always" visible?
Subviews outside bounds of superview are hidden (table view's cells are also its subviews). That's just how iOS view hierarchy works, not really about performance. And it doesn't make any sense when a subview/cell is displayed on the screen while user cannot interact with it (because it's out of bounds). In particular, table view reuses cells that go out of its bounds, so no, you cannot set a cell to be "always visible".

Resources