ios - How to navigate and pass data to another view controller without use of segue in swift -
hy, new swift. have on question. have 1 view controller in have textbox , button , have second view controller have textbox , button. want whenever pressed button of first view controller second view controller appear , data of textbox of first view controller pass textbox of second view controller without use of segue. please me.
in firstviewcontroller.swift
@ibaction weak var textfiled: uitextfield! @ibaction func senddatatonextvc(sender: uibutton) { let mainstoryboard = uistoryboard(name: "storyboard", bundle: nsbundle.mainbundle()) let vc : secondviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("secondviewcontrollersbid”) secondviewcontroller vc. recevedstring = textfiled.text self.presentviewcontroller(vc, animated: true, completion: nil) }
in secondviewcontroller.swift
var recevedstring: string = “” @ibaction weak var textfiled2: uitextfield! override func viewdidload() { super.viewdidload() textfiled2.text = recevedstring }
Comments
Post a Comment