views:

33

answers:

2

Hi,

I have a UITableView which has some dates on it. I would like to go directy to a specific entry (i.e. "today's date") in my tableview when I open it.

That means I want to have the past dates already scrolled down and the first line I see is the one with today's date. How can I do that?

Thanks,

Laurent

+2  A: 

Do you mean UITableView? Try this:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
tob
A: 

Ok thanks that seems to be what I need! But how should I use it? Is it right like this?

indexPath=[NSIndexPath indexPathForRow:7 inSection:0];
[self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];

(I found it on google). If yes what is the "UITableViewScrollPositionTop" for?

swissmade
This indicates where you want you cell (7,0) to be - on the top of the screen, on the bottom or in the middle.
sha