gpt4 book ai didi

ios - 标签栏 Controller 应该如何集成到导航 Controller 工作流程中?

转载 作者:可可西里 更新时间:2023-11-01 03:37:45 26 4
gpt4 key购买 nike

我得到了一个具有以下工作流程的设计:

  • 用户登录应用
  • 成功登录后,用户会看到一个包含数据行的 TableView
  • 单击数据行后,用户将被带到带有选项卡式界面的 View Controller 。选项卡式界面中的每个 View Controller 深入探讨 TableView 中显示的数据的某个方面。
  • 用户可以从任何选项卡按下后退按钮并返回到表格 View 。

根据此描述,在我看来,该应用程序需要一个导航 Controller Root View Controller 用于登录和表格 View ,然后在单击表格行后,该应用程序需要利用标签栏 Controller 来深入研究数据。

我似乎无法使用 Storyboard将 UITabBarController 添加到导航 Controller 。此外,我发现其他 SO 帖子也提出了类似的问题,但所提供的答案似乎都不是最新的,也没有使用当前 (iOS7/8) 最佳实践来解决此工作流程。有没有办法完成这个工作流程?如果没有,是否有简明的解释可供设计人员和利益相关者引用?

最佳答案

我检查了你的要求。

虽然 Apple Inc. 不推荐用于常规用例,

https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/TabBarControllers.html#//apple_ref/doc/uid/TP40011313-CH3-SW2

但可以通过以下步骤轻松实现建议的设计原则。

  1. 在 Storyboard中创建类似的设计,请注意导航 Controller 位于登录屏幕之前。

enter image description here

  1. 实现以下列表方法,以编程方式通过 ListView 调用特定选项卡。
 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"test" forIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:@"%ld", (long)[indexPath row]];
return cell;
}
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITabBarController *tbc = [self.storyboard instantiateViewControllerWithIdentifier:@"MainTabbedViewController"];
tbc.selectedIndex= (long)[indexPath row];
[self showViewController:tbc sender:self];
}
  1. 如果列表大小是动态的,您也可以通过编程方式创建标签栏项目。

https://24hrstech.wordpress.com/2012/08/19/create-tabbarcontroller-programmatically/

关于ios - 标签栏 Controller 应该如何集成到导航 Controller 工作流程中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28633278/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com