Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在Objective-C中使用TableViewController动态构建菜单_Ios_Objective C_Uitableview_Uinavigationcontroller_Storyboard - Fatal编程技术网

Ios 在Objective-C中使用TableViewController动态构建菜单

Ios 在Objective-C中使用TableViewController动态构建菜单,ios,objective-c,uitableview,uinavigationcontroller,storyboard,Ios,Objective C,Uitableview,Uinavigationcontroller,Storyboard,我对Objective-C和Xcode很陌生,所以我真的不知道如何使用TableView处理动态菜单 我正在生成表行,并希望通过单击行来加载其他ViewController。 我已尝试将该行链接到NavigationController,并希望在那里加载具有以下内容的进一步视图: NSString * storyboardName = @"Main"; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboa

我对Objective-C和Xcode很陌生,所以我真的不知道如何使用TableView处理动态菜单

我正在生成表行,并希望通过单击行来加载其他ViewController。 我已尝试将该行链接到NavigationController,并希望在那里加载具有以下内容的进一步视图:

NSString * storyboardName = @"Main";
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle: nil];
    UIViewController * vc = [storyboard instantiateViewControllerWithIdentifier:@"Fremdbearbeitung"];
    [self presentViewController:vc animated:YES completion:nil];
但我有一些问题,视图目前不在视图层次结构中。另外,我不知道如何通过从行中传递信息来动态地告知应该加载哪个InstanceViewControllerWithiIdentifier

你能告诉我如何处理这种最佳做法吗? 我是否可以告诉表中的行,当单击它们时,它们将被初始化到应该链接的位置

提前谢谢

编辑:找到一种适合我的方法:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

testclass *test = [self.array objectAtIndex:indexPath.row];

UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main"
                                              bundle:nil];
UIViewController* vc = [sb instantiateViewControllerWithIdentifier:test.second];

[self.navigationController pushViewController:vc animated:YES];
}
因此,我可以使用标识符动态地转到视图,该标识符是我在对象测试和第二个属性中为函数提供的

我不需要额外的导航控制器,因为我可以在主表视图中完成


这是一种好方法吗?

您希望按下viewController而不显示它。它将视图控制器推送到导航控制器的堆栈上,并更新显示

把这本书再读一遍。还要了解S

还有

此外,你还可以找到大量教程,介绍你想学习的所有基础知识,疯狂地使用谷歌吧


编辑:

谢谢你带我走上正确的道路。我用我的答案编辑了我的问题。你说什么?@Jan PhilippFischer,你现在所做的是对的。但是请记住,如果您的两个控制器都在同一个故事板中,那么您应该使用Segues而不是实例化故事板来始终获取控制器。签出已编辑答案中的链接。