Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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
Objective c 使用presentViewController:animated:completion时,如何将数据传递到显示的视图控制器_Objective C_Uiviewcontroller - Fatal编程技术网

Objective c 使用presentViewController:animated:completion时,如何将数据传递到显示的视图控制器

Objective c 使用presentViewController:animated:completion时,如何将数据传递到显示的视图控制器,objective-c,uiviewcontroller,Objective C,Uiviewcontroller,使用presentViewController:animated:completion方法时,如何将数据传递给显示的视图控制器?您应该在显示的视图控制器界面中公开属性,并从显示的视图控制器中进行设置 PresentedViewController* presented = [PresentedViewController new]; presented.stringProperty = @"Hello world!" [self presentViewController:presented

使用presentViewController:animated:completion方法时,如何将数据传递给显示的视图控制器?

您应该在显示的视图控制器界面中公开属性,并从显示的视图控制器中进行设置

PresentedViewController* presented = [PresentedViewController new];
presented.stringProperty = @"Hello world!"

[self presentViewController:presented animated:YES completion:^ {
    presented.anotherStringProperty = @"Hello again, world!"; //Set here if you need to pass the value after presentation.
}];

我需要在视图之间传递一个字符串。谢谢,这对我帮助很大!