I am saving the indexPath selection from a subview and passing it to the parent view with delegates. When I got back to my subview from my main view I pass the indexPath back to it and show the user which cell they previously selected with a tick in the accessory view of the tableviewcell.
One problem being if the user has selected a cell out of a fairly big list its hard to find the cell they selected again incase they wanted to change it (being that they made a mistake)
I would like to know if their is a way to use indexPath or something similar to center the previously selected cell of the uitableview to the center of the screen?
UPDATE::
Here is a graphical view of what I am trying to achive to make it abit more understandable..
step one : select cell then go to subview and select the cell (value) you want to pass back to main view (save indexPath of selected cell)
step two: user either wants to change his selection or made a mistake and was ment to select the cell below the one they chose... repeat previous steps but display previously selected cell in the center of the view..
IndexPath contains information about which row in which section the function is asking about. Base on this numbers you are configuring the cell to display the data for given row.
You can walk up the view hierarchy to find the containing table view cell and the containing table view. Then you can ask the table view for the cell's index path.
yes it is possible, I added the UITableVIew within the UITableView cell .. :) no need to add tableview cell in xib file - just subclass the UITableviewCell and use the code below, a cell will be created programatically.
indexPath(for:)Returns an index path that represents the row and section of a specified table-view cell.
Have you tried the following function
[tableView scrollToRowAtIndexPath: atScrollPosition:UITableViewScrollPositionMiddle animated:YES]
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