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.

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

Answers


Try something like this:

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

Use this for show first index in tableview.

 NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:1 inSection:0];
    [self.tbl_presentation selectRowAtIndexPath:myIndexPath animated:YES scrollPosition:UITableViewScrollPositionTop];

i hope this code useful for you.


Need Your Help

Exception rethrown at :

.net exception-handling stack-trace

I'm investigating a stack trace, and I came accross this output:

NSLog showing the previous Date

ios objective-c core-data nsdate

I want to retrieve all the entries from core data added between two dates.I am using NSPredicate. As I am not getting the correct result I tried logging the date.It is showing the previous dates.A...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.