我对 IOS 开发比较陌生。我想做这样的事情。我有一个表格 View ,单元格内有两个按钮。当我按下一个按钮时,它会显示一个警报 View 。当我按下确定时,它应该显示另一个表格view.but 在该 TableView 中应该有一个后退按钮,如导航 Controller 。到目前为止,我已经完成了警报 View 。我尝试了导航 Controller 教程。但所有这些都是通过表格 View 完成的。我想通过警报 View 操作来做到这一点。请有人帮助我..
我也尝试这样做:添加带有导航 Controller 的 TableView ,在 appdelegate.h 文件和我在代码下方的 m 文件中添加一个强属性
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
bundle: nil];
TableViewController *mainViewController = (TableViewController*)[mainStoryboard
instantiateViewControllerWithIdentifier: @"requests"];
// UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
self.navController=[[UINavigationController alloc]initWithRootViewController:mainViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window setRootViewController:navController];
[self.window addSubview:navController.view];
[self.window setBackgroundColor:[UIColor whiteColor]];
[self.window makeKeyAndVisible];
return YES;
但是当我运行应用程序时出现了这个错误
2014-03-24 12:18:38.348 varrdle_v2[1378:a0b] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“* -[__NSArrayM insertObject:atIndex:]:对象不能为 nil'
请有人帮助我..
谢谢
最佳答案
你应该推送 View Controller :
[self.navigationController pushViewController:self.mainViewController animated:YES];
如果您将 Root View Controller 的标题设置为某个内容,您的后退按钮将在里面而不是 Back (在 viewDidLoad
方法内):
self.title = @"Title";
关于ios - 表格 View 的导航问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22602888/