I want to make next:
I have an UITableView that have to dispaly words (A-Z).
Currently when view did load I have one cell that displayed (and this is correct). First cell display first word from my array words.
Purpose: I want to move to the cell that must display 10 word from my array, but problem is that the cell with indexPath.row = 10 does not exist (and this correct, because I don't scroll yet).
What is a right wait to make transition from 1 to 10 cell.
I think if I don't use dequeueReusableCellWithIdentifier
for creating my cell I can do it and solve my problem, but I mean this problem for device memory.
In other words I need to make scrollToRowAtIndexPath
Thanks!
moveRow(at:to:) Moves the row at a specified location to a destination location.
For performance reasons, a table view's data source should generally reuse UITableViewCell objects when it assigns cells to rows in its tableView(_:cellForRowAt:) method. A table view maintains a queue or list of UITableViewCell objects that the data source has marked for reuse.
You are right to identify the scrollToRowAtIndexPath
method. So all you need to do is create a fresh IndexPath with the row you wish to move to, e.g., row index = 10:
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:10 inSection:indexPath.section] atScrollPosition:UITableViewScrollPositionMiddle animated:NO];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With