selecting a row by means of a button ... using didSelectRowAtIndexPath
- by John Smith
hey people ,
I have a question concerning a button I would like to create which selects my previous selected row.
This is what I came up so far but since I'm new with the functionality and such I could definately use some pointers
I created a toolbar with a button and behind this button is the following action.
-(void)clickRow
{
selectedRow = [self.tableView indexPathForSelectedRow];
[self.tableView:[self tableView] didSelectRowAtIndexPath:selectedRow];
}
in my
didSelectRowAtIndexPath
there is a rootViewController being pushed
rvController = [RootViewController alloc] ...etc
So what I would like is my function clickRow to select the row and push the new rootviewcontroller (which has the right info since I'm using a tree ).
I tried something like this as well
-(void)clickRow
{
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
NSArray *Children = [dictionary objectForKey:@"Children"];
rvController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]];
rvController.CurrentLevel += 1;
rvController.CurrentTitle = [dictionary objectForKey:@"Title"];
[self.navigationController pushViewController:rvController animated:YES];
rvController.tableDataSource = Children;
[rvController release];
}
The last function works a little but a little is not enough;)
For instance if I press the middle row or any other it constantly selects the toprow.
thnx all for those of you reading and trying to help