Reputation: 6051
I am trying to create a UItableView
with infinite scrolling mode , I mean when tableview reaches at its end for example row 100
it must show row 0 to row 100 again. Is there any possible way to do so ? If yes can you help me out ?
Upvotes: 0
Views: 260
Reputation: 3597
I believe this could work theoretically but have never tried it myself.
Also, this only works if you scroll down infinitely, not up.
To do this, in cellForRowAtIndexPath
, you can use a switch statement where you are 'switching' indexPath.row % 99
(replace 99 with however many cells you have in total minus 1), and each case is 0, 1, 2, etc.
switch (indexPath.row % (dataSource.count() - 1) {
case 0:
case 1:
...
}
Hope this helps!
This answer also has a good solution.
Upvotes: 1