Iphone xCode - Navigation Controller on second xib view?

Posted by Frames84 on Stack Overflow See other posts from Stack Overflow or by Frames84
Published on 2010-04-13T15:29:23Z Indexed on 2010/04/13 15:33 UTC
Read the original article Hit count: 857

Filed under:
|

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 designer 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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about xcode