How to handle flickering and blank space issues while reloading the tableview? - ios

I am using Xamarin iOS and my table view contains multiple types of cells.
All the cells have dynamic height and different contents with multiple sections.
Here suppose I have total 10 cells out of which few are visible and others are hidden. Based on user action, It depends on whether to show or hide the cell.
In this scenario, If the number of cells is less, It's somehow working fine. But flickering and blank space are showing when the number of cells increases.

You need to reload only appropriate section or even rows instead of reload whole tableview.
Please checkout this solutions.
Reload sections in UITableView

Related

TableView reload not setting UITableView section height

I am working on a UITableView which has 2 sections, both of which have exactly 1 row which is a custom cell. This custom cell has a collection view which is used to display various products.
Specific to my issue, the two collection views have 6 cells(three rows in the collection view). However when I load the page, the second section only displays 4 cells (two rows in the collection view). I am using UITableViewAutomaticDimension for the tableview which has the cells that contain these collection views.
I have tried using setLayoutNeeded and layoutIfNeeded, I am calling reload data on the tableView in a number of places. I am reloading the second section specifically as well. However the only way the cell's dimensions get fixed is if I scroll down to the second section, then scroll up to the first and then go back to the second.
I have been stuck on this for the past 3 days and absolutely any help would be greatly appreciated.
However the only way the cell's dimensions get fixed is if I scroll
down to the second section, then scroll up to the first and then go
back to the second.
According to this, I think you should reload your collection views firstly. And then reload your table view.

How to increase number of preloaded UITableView cells in Swift?

I was wondering if it is possible to increase the number of preloaded UITableView cells.
The problem is, I have webviews in table cells and when you scroll down, they first show empty screen then load the page. Which doesn't look good.
I thought maybe I can solve this by loading more cells off the screen, so they appear more smoothly.
What do you think about this, is it possible?
You don't need to preload more cells. Instead create a data source implementation that fetches more data.

UITableView visible area blank when cells stored in array instead of reusing

I have a UITableView into which I populate a small number of static UITableViewCells (about 6 cells). I am not using storyboards. Each of these cells is a custom UITableViewCell, has a different layout, so I my thought is that cell reuse is never going to happen in this case.
So I am creating these cells beforehand and storing them into an NSArray. In cellForRowIndexAtPath I just return the corresponding cell that is already stored in my array.
Everything works fine with this approach on iOS6. However on iOS7, the visible area of the table view goes completely blank. When I scroll up, the part of the table view that was underneath the main view previously shows the cells (partial cell if the cell was partially underneath before). But the initial visible area of the table view still remains blank.
Two questions here - Is it fine to store the cells in an NSArray and return them in cellForRowAtIndexPath? As I mentioned earlier, the number of cells is small and each cell is unique, no reuse is going to happen while scrolling.
And what is going wrong in IOS7?

How many cells table view uses

I have 100 rows of data but when we i run the code in iPhone Retina(4-inch) simulator i can see only 14 fit on the screen at a time. If i count the number of visible rows then i get up to 13 but it’s possible to scroll the table in such a way that the top cell is still visible and a new cell is pulled in from below. So that makes at least 14 cells.
If you scroll really fast, then I guess it is possible that the table view needs to make a few more temporary cells, but I’m not sure about that.I want to know after how many cells a cell get reused?

ios UITableView reloads data when scroll down to bottom rows

I've implemented a pull down to refresh that sits above my UITableView.
However, UITableView also has a default setting where if you push up (to reveal rows at the bottom of the table), it also reloads the table data. Since I already have pull down to refresh, I want to disable this. How do I do that?
Thanks!
EDIT: I want to load all the rows of the UITableView at once, not just the visible rows, because I'm not loading too many rows anyway.
It's not that it's "reloading" the cells. If they have been dequeued, then they are being loaded. If you don't want those cells there, then why do you have them in the first place? If you scroll them off the screen they normally get dequeued to improve performance of the tableview. If you don't want this behaviour, then you may not want to dequeue your cells, but tableview performance could be drastically affected.

Resources