Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.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
如何在ios开发中从推送序列传递数据?_Ios_Segue - Fatal编程技术网

如何在ios开发中从推送序列传递数据?

如何在ios开发中从推送序列传递数据?,ios,segue,Ios,Segue,如果以前有人问过这个问题,我表示歉意,但我尝试搜索了几个小时,但找不到答案 我有一个应用程序,它有一个表视图,可以让用户查看他们的个人资料(我称之为ProfileTableView),还有一个推送序列,可以让用户编辑他们的个人资料(我称之为EditProfileTableView)。配置文件包含名称、地址等信息。我知道如何通过prepareforsgue方法将数据从ProfileTableView传递到EditProfileTableView。我的问题是,如何将数据从EditProfileTab

如果以前有人问过这个问题,我表示歉意,但我尝试搜索了几个小时,但找不到答案


我有一个应用程序,它有一个表视图,可以让用户查看他们的个人资料(我称之为
ProfileTableView
),还有一个推送序列,可以让用户编辑他们的个人资料(我称之为
EditProfileTableView
)。配置文件包含名称、地址等信息。我知道如何通过prepareforsgue方法将数据从
ProfileTableView
传递到
EditProfileTableView
。我的问题是,如何将数据从
EditProfileTableView
传递到
ProfileTableView

使用下面的代码传递数据

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
    {
        // Get reference to the destination view controller
        YourViewController *vc = [segue destinationViewController];

        // Pass any objects to the view controller here, like...
        [vc setMyObjectHere:object];
    } }

您可以使用委托模式或NSNotification。或者这两个控制器可以拥有相同的模型对象。

-(void)prepareforsgue:(UIStoryboardSegue*)segue发送方:(id)sender
是在应用程序即将导航到新的
viewController
之前调用的方法。在这里,您可以检查初始化了哪个
UIStoryboardSegue
,并确认要传递哪些数据。如下所示

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    if ([[segue identifier] isEqualToString:@"segueOfNewViewController"])
    {
        // Get a reference to the destination view controller
        DestinationViewController *destinationViewController = [segue destinationViewController];
//by this you are having exactly the same refrence of viewController which is going to be displayed.
// now set objects as you must
destinationViewController.object = @“”;
    } }

显示一些代码plz。您可以使用委托或完成块将数据从
EditProfileTableView
放回
ProfileTableView
如果您打开或关闭editview,您将如何从编辑切换到配置文件?如果它是一个展开段,那么您将使用相同的
prepareforsgue
方法。您还可以将这些数据保存在单例中。