ios - How to pass data from ViewController to embed View Controller -


i have view controller, user taps button , moves second view, , want pass data it, second view has navigation view controller, prepareforsegue() doesn't work here. shall pass data navigation view , second view or else?

according this: https://developer.apple.com/library/prerelease/ios/documentation/uikit/reference/uinavigationcontroller_class/#//apple_ref/occ/instp/uinavigationcontroller/topviewcontroller , following solution more correct: use "topviewcontroller" of uinavitaioncontroller.

override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) {     let segueid = segue.identifier ?? ""      switch segueid     {         case "tomynextvc":             let nc = segue.destinationviewcontroller as! uinavigationcontroller             let destinationvc = nc.topviewcontroller as! mynextviewcontroller             destinationvc.vartopass = myvartopass          default:             break     } } 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -