2

I'm newbie in iOS development, and have a problem with my application. I have implemented a tabbar navigation and a TableView, but when call method didselectrowatindexpath i dont see the detailView linked. This is the code of my app:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"ciao");
    // UITableViewStyleGrouped table view style will cause the table have a textured background 
    // and each section will be separated from the other ones.
    controller = [[DetailViewController alloc] init];
                                        //initWithStyle:UITableViewStyleGrouped 
                                        //andDvdData:[dao libraryItemAtIndex:indexPath.row]];
    controller.title = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"content"];
    [self.navigationController pushViewController:controller animated:YES];

}

#import "DetailViewController.h" 

@interface ListItemsTableView : UIViewController {

    IBOutlet    UITableView     *myTableView;
    Dfetch                      *dao;
    DetailViewController        *controller;

}
Dennis
  • 14,264
  • 2
  • 48
  • 57

1 Answers1

0

You're not using the right initializer for UIViewController.

The one you're expected to use is [UIViewController initWithNibName: bundle:] (documentation at Apple linked for you).

I suspect your "controller" object is NULL.

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • if he called `alloc` and `init` then 'controller' can not be as `nil`. – beryllium Nov 25 '11 at 11:20
  • well... it might not be NULL but the view controller probably isn't set up properly if one isn't using the designated initializer. [Here is a related question](http://stackoverflow.com/questions/772182/iphone-uiviewcontroller-init-method-not-being-called). – Michael Dautermann Nov 25 '11 at 11:22