推/呈现模态视图控制器
问题描述:
我在我的视图控制器(我们称之为TVC1)中有一张桌子。我在TVC1中有行,因此除了TVC1上的数据外,用户还可以输入更多的数据。所以,当有人点击TVC1中的特定行时,它会显示另一个视图控制器(我们称之为TVC2)。但是,当显示TVC2时,TVC1中的所有数据都被清除。如何将数据保存在TVC1中?我应该通过应用程序代理来完成吗?推/呈现模态视图控制器
DescriptionInputViewController *descriptionController = [[DescriptionInputViewController alloc]
initWithNibName:@"DescriptionInputView"
bundle:nil];
[self presentModalViewController:navController animated:YES];
[self.navigationController pushViewController:descriptionController animated:YES];
[descriptionController release];
答
在你的代码,你应该叫:
[self presentModalViewController:descriptionController animated:YES]
descriptionController是要显示视图控制器。
您能再发表更多信息吗?你如何打电话给TVC2?如果你只是将它弹出到视图控制器堆栈上,你是如何以及在哪里做的? – CajunLuke
我推它,我在那里发布代码。我尝试了pushViewController:animated:和displayModalViewController:animated:都清除了数据。 (descriptionViewController将是TVC2) – skylerl