0

如果 xml 文件包含超过 1 个文件,我现在正在检查我的应用程序,否则我想将视图控制器自动推送到另一个视图控制器。

我现在正在这样做,但它有效!

UIViewController *rootController = [[ViewControllerOne alloc] initWithNibName:@"ViewControllerOne" bundle:nil];

navigationController = [[UINavigationController alloc] initWithRootViewController:rootController];

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window addSubview:navigationController.view];
[self.window makeKeyAndVisible];

我需要将数据从第一个视图控制器发送到我通常推送到(ViewControllerOne)的那个我正在做的事情:

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]];

Controller.Title = [item objectForKey:@"Title"];
[self.navigationController pushViewController:Controller animated:YES];
Controller = nil;

我想组合这段代码,这样我就可以“重定向”控制器,如果它在 ViewController 中包含两个东西,它需要在视图控制器中不显示后退按钮的情况下推送它,我将数据推送到

4

2 回答 2

2

大声笑这就是答案!你刚刚发布了答案试试这个;

ViewControllerthree *Controller = [[ViewControllerthree alloc] initWithNibName:@"ViewControllerthree" bundle:[NSBundle mainBundle]];

    Controller.Title = [item objectForKey:@"Title"];
UIViewController *rootController = 
    [[ViewControllerOne alloc] 
     initWithNibName:@"ViewControllerOne" bundle:nil];

    navigationController = [[UINavigationController alloc]
                            initWithRootViewController:rootController];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window addSubview:navigationController.view];
    [self.window makeKeyAndVisible];
 [self.navigationController pushViewController:Controller animated:YES];
    Controller = nil;

瞧!

祝你好运,内森

于 2012-05-11T21:37:54.103 回答
0

如果没有“返回”按钮,你将如何关闭 UIViewController?

要隐藏“返回”按钮,请使用以下命令:

self.navigationItem.hidesBackButton = YES;
于 2012-05-11T20:52:27.667 回答