tags:

views:

454

answers:

1

Everything is fine, my navigation controller display's my 'Menu 1' item, but when i click it there appears to be a problem with the:

[self.navigationController pushViewController:c animated:YES]; line it doesn't connect to the break point in the myClass file. so I think i've not joined something? but unsure what?

My second view with the navigation controller doesn't have direct access to the AppDelegate so can't join it like I see in some tutorials.

1st view is just a button when clicked calls:

[self presentModalViewController:mainViewController animated:YES];

my second View 'MainViewController' header looks like:

@interface MainViewController :UITableViewController <UITableViewDelegate, UITableViewDataSource>
{
    NSArray *controllers;
    UINavigationController *navController;
}

@property (nonatomic, retain) IBOutlet UINavigationController *navControllers;

@property (nonatomic, retain) NSArray *controller;

Then I have my MainViewController.m

@synthesize controllers;
@synthesize navController;

- (void) viewDidLoad
{
    NSMutableArray *array = [[NSMutaleArray alloc] init];
    myClass *c = [[myClass alloc] initWithStyle:UITableViewStylePlain];
    c.Title = @"Menu 1";

    [array addObject:c];
    self.Controllers = array;
    [array release];
}

implemented numberOfRowsInSection and cellForRowAtIndexPath

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

    NSUInteger row = [indexPath row];
    myClass *c = [self.controllers objectAtIndex:row];
    [self.navigationController pushViewController:c animated:YES]; // doesn't load myClass c
    // [self.navController pushViewController:c animated:YES];
}

Also in Interface Builder I dragged a Navigation Controller onto my new XIB and changed the Root View Controller class to MainViewController and also connected the File Owner connector to the Navigation Controller to connect the navController Outlet.

Thanks for you time.

A: 

myClass.h

#import "SecondLevelViewController.h" //This inherts UITableViewController

@class myClass;

@interface myClass : SecondLevelViewController
{
NSArray *list;
myClassDetail *detail;
}
@property (nonatomic, retain) NSArray *list;

myClass.m

#import "myClass.h"
#import "myClassDetail.h"
#import "NavAppDelegate.h"

@implementation myClass
@systjesize list;

- (void) viewDidLoad
{
  NSArray *array = [[NSArray alloc] initWithObjects:@"test1",@"test2",nil];
self.list = array;
.. .. ..
//I can't get a break point at this point or in any of the other methods
}

So not getting a break point to hit in this page tells me I've missed sometihng. With this being a seperate XIB file from the MainWindow.XIB, I don't have access to the App Delegate.

So really I need to know how to wire Navigation Controller to a second view XIB file when I don't have a App delegate in the interface builder. All the tutorials show the navigation controller being connected to this app delegate.

The program complies file and runs, I get the 1st 'Menu 1' in the list but then when I try and re populate the same navigation list with my new myClass menu items 'test 1', 'test 2' it doesn't hit the event viewDidLoad.

Frames84