0

sideMenuのSWRevealViewControllerを実装しました。私のプロジェクトはSwiftで、SWRevealViewControllerはObjective-cです。 SWRevealViewControllerは初期ビューControllerではありません.1つの初期ViewContoller(1VC)があり、SWRevealViewControllerでPush Segueを持っています。別のViewController(2VC)がFrontViewとして動作します。私は(1VC)から(2VC)にデータを渡したいと思います。私はどのような方法SWRevealViewControllerを持つ別のViewControllerから別のViewControllerにデータを送信する方法

enter image description here Here is My Stroyboard

+0

? –

+0

一部の文字列Intial ViewController(SWRevealViewControllerの前)からanotherViewController(SWRevealViewControllerSegueSetController segueのDashBoardです) –

+1

このような状況では、NSNotificationCenterが機能を完遂する最も良い方法です。詳細については、https://iosdevcenters.blogspot.com/2016/03/nsnotification-nsnotificationcenter-in.html –

答えて

0

二つの方法を見つけることができませんでした:SWIFTのすべてでセグエ

override func prepareForSegue(segue: UIStoryboardSegue!,sender: AnyObject!){   
//make sure that the segue is going to secondViewController 
if segue.destinationViewController is secondViewController{ 
// now set a var that points to that new viewcontroller so you can call the method correctly 
let nextController = (segue.destinationViewController as! secondViewController) 
nextController.setResultLabel((String(myResult))) 
} 
} 

の場合

そうでない場合は、デフォルトではpublicです。クラス

import UIKit 

var placesArray: NSMutableArray! 

class FirstViewController: UIViewController { 
// 
.. 
// 
} 

外の変数を定義し、それにアクセス

import UIKit 

class SecondViewController: UIViewController { 
// 
placesArray = [1, 2, 3] 
// 

}

送りたいデータの種類
+0

Thx、this works –

+0

楽しさはすべて私のものです –

関連する問題