1.First in storyboard , select button to contact Second View Controller ,choose “present modally” ,then will gernate segue
2.in viecontroller ,use prepare method so whenever the segue is triggered ,will execute the prepare method
3.in prepare function ,sender value is from button ,so sender need to as! UIButton
4.1 how to set the Secondviewcontroller property?
first ->in Secondviewcontroller declare a property var name ,then set
self.nameLabel.text = name
4.2 why i need to gernate a property name and then set self.nameLabel.text = name ??
because when the Secondviewcontroller is present , its @IBOutlet nameLabel is nil like below
so i need to change the code into this below
5.run the app
Originally published at swifthao的ios學習紀錄blog.