Search code examples
iphoneiosuitableviewreloaddata

Always show from the first index of the table?


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.

enter image description here

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!!!


Solution

  • Try something like this:

    - (void)viewWillAppear:(BOOL)animated
    {
        [self.tableView scrollRectToVisible:CGRectMake(0, 0, 1, 1) animated:YES];
    }