Ios 如何在使用swrevealviewcontroller时将数据从一个ViewController传递到另一个ViewController?

Ios 如何在使用swrevealviewcontroller时将数据从一个ViewController传递到另一个ViewController?,ios,objective-c,swift,uiviewcontroller,swrevealviewcontroller,Ios,Objective C,Swift,Uiviewcontroller,Swrevealviewcontroller,这是我的代码: let swswipe:SWRevealViewController=UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("swswipe") as! SWRevealViewController if(indexPath.row==0) { let swipe=swipeView() s

这是我的代码:

   let swswipe:SWRevealViewController=UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("swswipe") as! SWRevealViewController
        if(indexPath.row==0)
        {

           let swipe=swipeView()
            swipe.collectionClick="one"
            self.presentViewController(swswipe, animated: true, completion: nil)

        }



            front
              |
1st view <->swreveal<->2ndview(swipe)

您可以通过以下任一方式执行此操作:

  • 当第二个控制器离开时发送通知,并让父控制器侦听该通知

  • 创建一个委托协议,让第二个控制器直接引用父方法

  • (如果需要在后退按钮上执行此操作)使用父视图的ViewWillDisplay:并检查isMovingToParentViewController属性是否只是重新显示


并应用最适合您的值传递条件和值可用性的方法。

您尝试过委托模式吗?没有,我没有尝试委托模式,请您简要解释一下@ismail,但我正在使用集合视图,同时单击我需要发送字符串的单元格…@ismail
 print("coming to collection view", self.collectionClick)