Im a beginner, so I apologize for anything that seems overlooked or simple.
Basically, what I am trying to do is have a date picker on a screen update a UILabel, and then take that result of the update UILabel and push it back to another UILabel on the previous screen. I have the date picker working great and it updates the UILabel as expected, but I can't figure out how to code it so that I can update the first UILabel with the results from the DatePicker. Here is what i have for the DatePicker.
class StartDatePickerViewController: UIViewController {
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var datePicker: UIDatePicker!
override func viewDidLoad() {
super.viewDidLoad()
datePicker.addTarget(self, action: Selector("datePickerChanged:"), forControlEvents: UIControlEvents.ValueChanged)
// Do any additional setup after loading the view.
}
func datePickerChanged(datePicker:UIDatePicker) {
var dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = NSDateFormatterStyle.ShortStyle
var strDate = dateFormatter.stringFromDate(datePicker.date)
dateLabel.text = strDate
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
I need StartDatePickerViewController to update my UILabel startDateLabel on the AddNewTradeViewController and I'm not sure how to approach this properly. Any advice would be greatly appreciated!