selecting a row by means of a button ... using didSelectRowAtIndexPath

Posted by John Smith on Stack Overflow See other posts from Stack Overflow or by John Smith
Published on 2009-08-24T06:59:20Z Indexed on 2010/04/12 4:03 UTC
Read the original article Hit count: 255

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone