Reputation: 11
I have UIViewController in Viewbased application. I want to push another UIViewcontroller from it.
-(IBAction) Myfunction
{
MedicineSearchSystem *medicineSearchSystem = [[MedicineSearchSystem alloc] initWithNibName:@"MedicineSearchSystem" bundle:nil];
[self.parentViewController:medicineSearchSystem animated:YES]; // Crash here
}
Upvotes: 0
Views: 2611
Reputation: 18741
As warrenm already told you, first check if your viewController has a navigationController by calling something like : NSLog(@"%@", self.navigationController) then you can push using:
[self.navigationController pushViewController:medicineSearchSystem animated:YES];
self.mainItemListViewController = [[[NCItemsViewController alloc] init] autorelease];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.mainItemListViewController];
[window addSubview:[self.navigationController view]];
[window makeKeyAndVisible];
Upvotes: 1