Update data source of an UITableView with new data after scrolling table to the bottom

Matrosov Alexander

I have backend that return data based on the parameters. So the parameters include offset and limit keys.

It is something like pagination if you know. So based on the offset and limit server return to me appropriate amount of item from the data base.

At first run, I load 30 items from the 0 offset position. Then I need to load more items after I scrolled down my table and update datasource.

I have found the solution but the problem will be as well not to duplicate data when I will scroll up and then one more scroll down. Maybe there is already made solution or example. Of course I can write some my "wheel", but maybe some one can suggest best algorithm, maybe also using scroll view delegate it is not so good, instead of this maybe better use cellForRowAtIndexPath to determine for example some cell that near to the end of the cells and then update it.

Andy Obusek

I've solved this same problem with using willDisplayCell and the following two conditions that control whether more items are loaded:

  • Use a condition to check that the "total" number of items loaded from the API is greater than the number of rows already in the UITableView
  • Use a condition to check that the "row to display" is at a count that is greater than the number of rows already loaded

Basically, it's a slight modification of this answer: https://stackoverflow.com/a/19448220/209867

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why UITableVIew Display Data Incorrectly After Scrolling

From Dev

Reloading a Core Data UITableView after iCloud update

From Dev

Reloading a Core Data UITableView after iCloud update

From Dev

UITableView Pagination - Bottom Refresh to Load New Data in Swift

From Dev

Incorrect data on scrolling UITableView and UICollectionView

From Dev

UITableView does not reload after data source merging with background NSManagedObjectContext

From Dev

iOS - UITableView not scrolling to bottom

From Dev

UITableView not scrolling to bottom

From Dev

SQL Update a whole table with new data

From Dev

Table view cells showing actual data only after scrolling once

From Dev

Table view cells showing actual data only after scrolling once

From Dev

Update a data table after click button with primefaces

From Dev

UITableView data displays multiple times when scrolling

From Dev

UITableView Custom cell data mismatched on fast scrolling

From Dev

Material UI table data refresh after redux update data

From Dev

Is there a new Instagram data source?

From Dev

UITableViewCell Data changes after scrolling

From Dev

Swift updating UITableView with new data

From Dev

UPDATE source table, AFTER Grouping?

From Dev

Postgresql - How update another table after update one with specific data

From Dev

Referencing the same table both as target of UPDATE and source of data in MySql

From Dev

Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

From Dev

Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

From Dev

#1093 - Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

From Dev

Update a table after insert data on another table using trigger

From Dev

Trigger update the same table with data from another table after insert

From Dev

UITableView Not Scrolling after contentInset

From Dev

UITableView Not Scrolling after contentInset

From Dev

UITableView add new rows to bottom with animation without reloading entire table

Related Related

  1. 1

    Why UITableVIew Display Data Incorrectly After Scrolling

  2. 2

    Reloading a Core Data UITableView after iCloud update

  3. 3

    Reloading a Core Data UITableView after iCloud update

  4. 4

    UITableView Pagination - Bottom Refresh to Load New Data in Swift

  5. 5

    Incorrect data on scrolling UITableView and UICollectionView

  6. 6

    UITableView does not reload after data source merging with background NSManagedObjectContext

  7. 7

    iOS - UITableView not scrolling to bottom

  8. 8

    UITableView not scrolling to bottom

  9. 9

    SQL Update a whole table with new data

  10. 10

    Table view cells showing actual data only after scrolling once

  11. 11

    Table view cells showing actual data only after scrolling once

  12. 12

    Update a data table after click button with primefaces

  13. 13

    UITableView data displays multiple times when scrolling

  14. 14

    UITableView Custom cell data mismatched on fast scrolling

  15. 15

    Material UI table data refresh after redux update data

  16. 16

    Is there a new Instagram data source?

  17. 17

    UITableViewCell Data changes after scrolling

  18. 18

    Swift updating UITableView with new data

  19. 19

    UPDATE source table, AFTER Grouping?

  20. 20

    Postgresql - How update another table after update one with specific data

  21. 21

    Referencing the same table both as target of UPDATE and source of data in MySql

  22. 22

    Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

  23. 23

    Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

  24. 24

    #1093 - Table is specified twice, both as a target for 'UPDATE' and as a separate source for data

  25. 25

    Update a table after insert data on another table using trigger

  26. 26

    Trigger update the same table with data from another table after insert

  27. 27

    UITableView Not Scrolling after contentInset

  28. 28

    UITableView Not Scrolling after contentInset

  29. 29

    UITableView add new rows to bottom with animation without reloading entire table

HotTag

Archive