0
votes

UITabBarViewController & UINavigationController & UITableView

My app crashes when I try to push a detail view controller when selecting a cell.

If I empty the detail view controller I am trying to push, it works, but when I add UITextFields and action buttons to the view, the app crashes.

Here is my code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
     NSUInteger row = [indexPath row];

     if(self.addSimpleTrainingVC == nil)
        {
            AddDetailVC *tempVC = [[AddDetailVC alloc] initWithNibName:@"addDetailVC" bundle:nil];
            self.addDetailVC = tempVC;
            [tempVC release];
        }
     addDetailVC.title = [NSString stringWithFormat:@"%@",[myArray objectAtIndex:row]];

     [self.navigationController pushViewController:self.addDetailVC animated:YES];

     addDetailVC.title = [NSString stringWithFormat:@"%@",[myArray objectAtIndex:row]];

   //   myAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
   //     [delegate.myNavBarController pushViewController:addDetailVC animated:YES];
   //   self.addDetailVC.view.hidden =NO;
   // [delegate.myNavBarController pushViewController:addDetailVC animated:YES];

}
1

1 Answers

1
votes

If the view is being loaded OK when there are no UI elements, then most probably there must be something wrong at the interface builder side of things. Probably, an outlet/IBAction was defined and it can no longer be found.

The best thing to do is to open the 'Console' application (comes default in a Mac). Then, run your simulator and let the application crash. The Console will let you know what went wrong and will probably provide the source of the error. You might be seeing something like this:

11-08-04 1:02:06 AM StackOverFlow[10840] ** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "Detail" nib but the view outlet was not set.'*