ios - How do I show UITextField data on a UILabel in a second UIViewController in swift? -
i'd pass through data entered uitextfields
in current view controller second view controller on save button action. i'm using storyboards, advise me on how achieve this? i'm using xcode 6.
@ibaction func savebuttontapped(sender: anyobject) { let viewcontroller = secondviewcontroller(); viewcontroller.name = self.nametextfield.text; viewcontroller.phone = self.phonetextfield.text; viewcontroller.city = self.citytextfield.text; }
i found problem
@ibaction func savebuttontapped(sender: anyobject) { let viewcontroller = secondviewcontroller(); viewcontroller.name = self.nametextfield.text; viewcontroller.phone = self.phonetextfield.text; viewcontroller.city = self.citytextfield.text; }
problem line let viewcontroller = secondviewcontroller()
i changed to
let viewcontroller = self.storyboard!.instantiateviewcontrollerwithidentifier("secondviewcontroller") as! secondviewcontroller
with change code working fine thanks..
Comments
Post a Comment