iPhone导航

时间:2010-07-21 07:16:33

标签: iphone

这是我的流程 的 navA-> navB-> navC 然后当用户按下NavC后退按钮时,他会转到navA

但是当用户再次按下navA时,他应该去navB但是它继续使用navC我不知道为什么

在navC中我做了这个

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

在navA中我正在这样做去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];

1 个答案:

答案 0 :(得分:3)

尝试使用UINavigationController的推/弹方法:

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

从应用窗口添加和删除视图的操作

更新:

您可以在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作为@property。

尝试创建一个新的“基于导航的应用程序”或“Tab Bat应用程序”。