将文本保存到另一个视图控制器

时间:2014-05-25 05:22:14

标签: ios objective-c

我使用此代码它工作正常,但不是我想要的方式。我不希望这个IBAction带我到第二个View Controller我只想将它保存到第二个View Controller。

- (IBAction)passtexttovc2:(id)sender {
    ViewController2 *vc2 =[self.storyboard instantiateViewControllerWithIdentifier:@"ViewController2"];
    vc2.stringfromteztfield1= self.Actionforbutton.text;
    [self presentViewController:vc2 animated:YES completion:NO];
}

3 个答案:

答案 0 :(得分:-1)

删除

[self presentViewController:vc2 animated:YES completion:NO];

只在你想要的时候出现。

答案 1 :(得分:-1)

此处不需要presentViewController方法。你不需要出席'这里的视图控制器本身。

答案 2 :(得分:-1)