Arvind Kumar
Arvind Kumar

Reputation: 2421

Interview Que Tableview reuseIdentifier Internal working

If I have 500 records to show in UITableview and We implemented with reuseIdentifier in cellforRowAtIndexPath and at a time 4 records(Cell) are visible and as I know 4 cells view will be loaded and it will be reused when scroll.

And the condition is that if I scroll little bit it shows Half of 1st Cell and Half of 5th Cell then cell will be reuse for 5th cell or not if it reuse then what will be the condition of first cell.

I have research on it but still I am not sure what will be internally. This question I got my Interview duration.

Thanks

Upvotes: 1

Views: 250

Answers (1)

Lu_
Lu_

Reputation: 2685

It will be 5 cells first is still visible like 5th is, next cell is loaded just when it is on edge of tableview and will be shown, first cell will not be available just after disapearing behind the edge of tableview.

You can easily see that by setting breakpoint in cellForRowAtIndexPath method and printing tableview.visibleCells.count

Upvotes: 1

Related Questions