I have an UIViewController, this controller is contained in a navigationController. I add an UITableViewController in this viewController. I would like to call a pushViewController method when I press on a cell of my tableView.
I tried this :
UITableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FirstView *myViewController = [[FirstView alloc] init];
[f pushIt];
}
UIViewController (FirstView)
-(void)pushIt
{
SecondView *sCont = [[SecondView alloc] initWithNibName:@"SecondView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:sCont animated:YES];
NSLog(@"didSelect"); // is printed
[sCont release];
sCont = nil;
}
But nothing happen. I put NSLog() to my pushIt method and I can see it. So I don't understand why I can't push it.
Any idea?