标签栏控制器之前的 UINavigation 控制器

发布于 2025-01-06 00:32:11 字数 183 浏览 3 评论 0原文

我希望在实际的标签栏控制器流程启动之前有一个导航控制器注册流程。现在我已经用两个代表创建了两个不同的应用程序。

我认为可以先加载我的注册导航控制器 xib 流,然后在注册完成后关闭它并加载选项卡栏控制器。

我认为这将在单个应用程序委托中完成,但无法完全想出首先调用导航控制器流的代码,完成后单击按钮将加载选项卡流/xib

I want to have a navigation controller enrollment flow before my actual tab bar controller flow starts up. Right now I've created two different apps with two delegates.

I thought it might be possible to load my enrollment navcontroller xib flow first, then upon enrollment completion close it and load the tab bar controller.

I'm thinking this would be done in a single app delegate, but can't quite come up with the code to call navigation controller flow first and when finished a button clicked would load the tabbar flow/xib

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

戏剧牡丹亭 2025-01-13 00:32:11

事实证明这并不难,只需一些简单的事情就可以理解。

首先,如果您要创建 TabBar 控制器,则 TabBar 控制器必须始终是根视图。一旦您知道这一点,下一步就是查看 TabBar 控制器首先调用哪个视图或 xib。

一旦你知道了这一点,就可以转到视图或 xib 的视图控制器代码。在该代码中创建函数

- (void) viewDidAppear:(BOOL)animated{
}

在上面的函数中,您可以注入导航视图,但首先您必须告诉导航视图您想要显示的第一个视图是什么,如下所示:

PersonalInfoVC *personalInfoVC = [[PersonalInfoVC alloc] initWithNibName:@"PersonalInfoVC" bundle:nil];
UINavigationController *navController  = [[UINavigationController alloc]  
                                           initWithRootViewController:personalInfoVC];
[self.tabBarController presentModalViewController:navController animated:YES];

然后在每个视图中调用下一个视图,使用如下代码 最后,

DepositDetailsVC *depositDetailsVC = [[DepositDetailsVC alloc] initWithNibName:@"DepositDetailsVC" bundle:nil];
[self.navigationController pushViewController:depositDetailsVC animated:YES];

当您完成注入导航控制器的流程时,运行此代码即可返回到原始 TabBar 控制器,

[self.navigationController dismissModalViewControllerAnimated:YES];

非常简单。 :)

Turns out this isn't too hard, just a few simple things to understand.

First if you are creating a TabBar Controller, the TabBar Controller will always have to be the root view. Once you know this the next step is to see what view or xib the TabBar controller calls first.

Once you know this go to the view or xib's view controller code. In that code create function

- (void) viewDidAppear:(BOOL)animated{
}

Within the above function you can inject the navigation view, but first you must tell the navigation view what the first view you want to be displayed, done like this:

PersonalInfoVC *personalInfoVC = [[PersonalInfoVC alloc] initWithNibName:@"PersonalInfoVC" bundle:nil];
UINavigationController *navController  = [[UINavigationController alloc]  
                                           initWithRootViewController:personalInfoVC];
[self.tabBarController presentModalViewController:navController animated:YES];

then in each view to call the next view use code like this:

DepositDetailsVC *depositDetailsVC = [[DepositDetailsVC alloc] initWithNibName:@"DepositDetailsVC" bundle:nil];
[self.navigationController pushViewController:depositDetailsVC animated:YES];

Finally when you are done with the flow of the injected navigation controller run this code to go back to your original TabBar controller

[self.navigationController dismissModalViewControllerAnimated:YES];

Easy enough. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文