iphone selecting a row to change view

Posted by Rob J on Stack Overflow See other posts from Stack Overflow or by Rob J
Published on 2010-06-08T19:48:19Z Indexed on 2010/06/08 19:52 UTC
Read the original article Hit count: 204

Filed under:
|

I have created the view Controllers and attached those to control their respective views. I can't figure out how to make the following code to go the right views though. (This is in the root view controller:)

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

 RunViewController *runViewController = [[RunViewController alloc] initWithNibName:@"RunView" bundle:[NSBundle mainBundle]];
 CalcViewController *calcViewController = [[CalcViewController alloc] initWithNibName:@"CalcView" bundle:[NSBundle mainBundle]];
 PushViewController *pushViewController = [[PushViewController alloc] initWithNibName:@"PushView" bundle:[NSBundle mainBundle]];
 SitViewController *sitViewController = [[SitViewController alloc] initWithNibName:@"SitView" bundle:[NSBundle mainBundle]];
 TimerViewController *timerViewController = [[TimerViewController alloc] initWithNibName:@"TimerView" bundle:[NSBundle mainBundle]];

 [self.navigationController pushViewController:runViewController animated:YES];
 [runViewController release];
 [self.navigationController pushViewController:pushViewController animated:YES];
 [pushViewController release];
 [self.navigationController pushViewController:sitViewController animated:YES];
 [sitViewController release];
 [self.navigationController pushViewController:timerViewController animated:YES];
 [timerViewController release];
 [self.navigationController pushViewController:calcViewController animated:YES];
 [calcViewController release];

 runViewController = nil;
 pushViewController = nil;
 sitViewController = nil;
 timerViewController = nil;
 calcViewController = nil;


}

Each time I select any of the rows in the table - all of the views come up. How do I arrange them to only open the view that it is supposed to?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c