2010-07-21 72 views
0

这是我的流程 navA-> navB-> NAVC那么当用户按下NAVC后退按钮,他去纳瓦导航的iPhone

但是当用户再次按下纳瓦他应该去navB但其回事NAVC我不知道为什么

在NAVC

我这样做

XMLAppDelegate *appDelegate=(XMLAppDelegate*)[UIApplication sharedApplication].delegate; 
    [self.view removeFromSuperview]; 
    [appDelegate.window addSubview:appDelegate.preLoginNavController.view]; 

和纳瓦我这样做去navB // 这是preLoginNavController.m XMLAppDelegate appDelegate =(XMLAppDelegate)[UIApplication sharedApplication] .delegate;

//appDelegate.RootNavController.shouldHasBackButton = YES; 
    [self.navigationController.view removeFromSuperview]; 
    [appDelegate.window addSubview:appDelegate.navigationController.view];//[navigationController view] 

和appdidfinish()

[window addSubview:[preLoginNavController view]]; 
    [window makeKeyAndVisible];**strong text** 

终止应用程序由于未捕获的异常“NSInvalidArgumentException”,原因是:为什么我使用这个

“推导航控制器,不支持”这就是
appDelegate.newsNavController.shouldHasBackButton = YES; 
[appDelegate.window addSubview:appDelegate.newsNavController.view]; 

我需要推你定义的方法还是我可以在添加子视图时使用?

AccountApplication* controller = [[AccountApplication alloc] initWithNibName:@"AccountApplication" bundle:nil]; 
     //  [self.navigationController pushViewController:controller animated:YES]; 
     //  [controller release]; 

回答

3

尝试使用的UINavigationController的推/ pop方法:添加和删除您的应用程序的窗口视图的

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated 

instad

UPDATE:

你可以在你的appDelegate中创建你自己的UINaviagtioNController:

- (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; 

}

与navigationController作为@属性。

尝试创建一个新的“基于导航的应用程序”或“选项卡蝙蝠应用程序”。

+0

检查更新以上 – ram 2010-07-21 07:31:00

+0

如果我推新的然后我需要弹出旧的或只是继续推whatevr我需要???? – ram 2010-07-21 07:52:08

+0

任何推送UIViewController被添加到堆栈,并保持在那里,除非你弹出它或孔堆栈。 请参阅参考类别: http://developer.apple.com/iphone/library/documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html – AlexVogel 2010-07-21 14:22:05