如何在不使用segue的情况下将数据从一个ViewController传递到MainViewController?

时间:2015-03-20 08:21:51

标签: ios objective-c uiviewcontroller segue

我想将数据从ParcelResultViewController发送到ViewController(Main),但我没有ParcelResultViewController和viewcontroller之间的连接segue。我分享了我的故事板图像和代码块。

如何处理这种情况?

ParcelResultViewController.m

if (nil == self.viewcontroller) {
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
        self.viewcontroller = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
        self.viewcontroller.fieldAliases = self.gonderilenFeatureSet.fieldAliases;
        self.viewcontroller.displayFieldName = self.gonderilenFeatureSet.displayFieldName;

        NSLog(@"%@",[self.gonderilenFeatureSet.features objectAtIndex:indexPath.row]);

    }

    //the details view controller needs to know about the selected feature to get its value
    self.viewcontroller.feature = [self.gonderilenFeatureSet.features objectAtIndex:indexPath.row];

enter image description here

1 个答案:

答案 0 :(得分:2)

从解析控制器发送通知,并将数据作为对象。

使用NSNotificationCenter执行此操作。