this is my flow navA-> navB->navC then when user press NavC back button he goes to navA
but when user again press navA he should go to navB but its going on navC I don't know why
in navC i did this
XMLAppDelegate *appDelegate=(XMLAppDelegate*)[UIApplication sharedApplication].delegate;
[self.view removeFromSuperview];
[appDelegate.window addSubview:appDelegate.preLoginNavController.view];
and in navA i am doing this to go to navB //this is preLoginNavContro开发者_如何学JAVAller.m XMLAppDelegate appDelegate=(XMLAppDelegate)[UIApplication sharedApplication].delegate;
//appDelegate.RootNavController.shouldHasBackButton = YES;
[self.navigationController.view removeFromSuperview];
[appDelegate.window addSubview:appDelegate.navigationController.view];//[navigationController view]
and in appdidfinish()
[window addSubview:[preLoginNavController view]];
[window makeKeyAndVisible];**strong text**
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Pushing a navigation controller is not supported' thats why i am using this a
appDelegate.newsNavController.shouldHasBackButton = YES;
[appDelegate.window addSubview:appDelegate.newsNavController.view];
do I need to push in the method defined by you or I can use in between while adding subview??
like
AccountApplication* controller = [[AccountApplication alloc] initWithNibName:@"AccountApplication" bundle:nil];
// [self.navigationController pushViewController:controller animated:YES];
// [controller release];
Try to use the push/pop methods of UINavigationController:
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
instad of adding and removing views from your app window
UPDATE:
You can create your own UINaviagtioNController in your appDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after app launch
UIViewController *rootViewController = [[UIViewController alloc]init];
navigationController = [[UINavigationController alloc]initWithRootViewController:rootViewController];
[rootViewController release];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
with navigationController as @property.
Try to create a new "Navigation-based Application" or a "Tab Bat Application".
精彩评论