Hello all , I have a question concerning the following issue. I would like to return to the top of my tableview everytime I press a cell
This is a piece of the code that does it.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
....
...
...
[self.tableView setContentOffset:CGPointMake(0, 0) animated:NO];
Now I have a nextbutton (next video )
http://yfrog.com/0wpicture7qyp
And behind this button is this function
-(void)selectNextRow:(id)sender
{
NSUInteger row = currentRowSelection.row;
NSUInteger section = currentRowSelection.section;
++row;
if(row >= [self.tableView numberOfRowsInSection:currentRowSelection.section])
{
row = 0;
++section;
if( section >= [self.tableView numberOfSections])
{
row = 0;
section = 0;
}
}
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section] animated:YES scrollPosition:UITableViewScrollPositionBottom];
[self tableView:[self tableView] didSelectRowAtIndexPath:currentRowSelection];
}
Now I would think that everytime I select a row the didSelectRowAtIndexPath would go to the top. However it only does this when I manually select a row and not when I use the function selectNextRow .. which as it says selects the next row. So my question is why is it doing this?