swift - Prepareforsegue data passing with multiple tableviewControllers in-between? -
okay found code youtube video data passed 1 viewcontroller , works fine but, need pass across multiple view controllers , not 1 other.
youtube video along project in desc:https://www.youtube.com/watch?v=kpwrc1prdsg
here code:
class viewcontroller: uiviewcontroller { @iboutlet weak var textfield: uitextfield! override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { let nextvc: secondviewcontroller = segue.destinationviewcontroller as! secondviewcontroller nextvc.recevedtext = textfield.text! }
then secondviewcontroller code:
class secondviewcontroller: uiviewcontroller { var recevedtext: string = "" @iboutlet weak var textlable: uilabel! override func viewdidload() { super.viewdidload() textlable.text = recevedtext }
i have heard of delegates before have difficulty them.
if need pass on value across multiple view controller, 1 possible way use global variables can updated , used in of view controller.
caution: global variables tedious , need keep track of updating , sequence of usage.
Comments
Post a Comment