0

我有一个带有 UIView 和一个按钮的视图。按下按钮会弹出一个 ModalViewController,它是 UIView,里面有 UITextField。我需要将 UIView 中 NSObject 的字符串值作为字符串传递给 ModalViewController。在按钮点击我称之为:

-(void) editNote{

TextViewController * vc = [(TextViewController *)[TextViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];

[self.navigationController presentModalViewController:nav animated:YES];
[vc release];
}   

通常,在行选择时,我们使用 pushviewcontroller 将数据推送到下一个视图,但是在做了很多谷歌之后,我无法弄清楚如何使用 presentmodalviewcontroller 传递数据。

4

1 回答 1

5

您可以向 TextViewController 添加一个属性,然后只需使用vc.object = myObject. 或者,您可以制作一种init需要更多信息的新方法。

于 2011-08-17T20:07:14.297 回答