I have a UITableView
in one of my view. Lets say the tableView
has 100 index. If I scroll down and select 50th index, its pushing to another view.
So what I want is, if I pop back to tableView view from second view, the tableView should show from the first index.But currently its was in the index where I selected previously.Please refer the below image for better understanding.
Here "smart" is the 25th index.If I select smart, it pushes to another view(Detailed view).So if I again come back to this tableView, the table should reset and display from first view.How can I achieve this? I tried reloading table and it doesn't work.
Please suggest your ideas.
Thank you!!!
Save the row index or value before navigating to another view which you want to keep highlighted and show it on view.
After that when you come back to the same view then just add the following line:
This will solve your problem.
Do anything in
viewWillAppear
method as it will becalled
when ucome back
.Use this for show first index in
tableview
.i hope this code useful for you.
Try something like this:
You need to ask the table view to scroll to the first row using
scrollToRowAtIndexPath:atScrollPosition:animated:
using a scroll position ofUITableViewScrollPositionTop
. You may want to do this after a delay depending on what other animations you have going on.