简体   繁体   中英

How to scroll to specific Cell (determined by its label) in UITableView

i wanted to know if its possible to scroll to a specific Cell (determined by the Cell's label and not by the cell's rowindex) in an UITableView?

I need this cause my data is loaded on the fly and i don't know the cell's row index.

For example: I have a UITableView with a variable amount of rows and in each row there is a label for a name. Now i want to scroll to a specific name, but have the problem that I don't know the rowindex for this.

Is there any solution?

Thx in advance!

Search in your data sourceArray for the name, get the index of the object and construct the index path.

 [NSIndexPath indexPathForRow:yourRow inSection:yourSection];

If you have multiple sections you also have to find the section.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM