Gold Challenge - return back the NSDate value (a solution)


#1

Hello,

because I spent a lot of time on it … there is my solution too send back data from the ChangeDateViewController to the DetailViewController.

in the ChangeDateViewController’s ViewWillDisappear: you can pass a value to another view of the navigationController chain with the childViewControllers:
In this case, I declared a NSDate *passedDate in DetailViewController.h

DetailViewController *returnDetailViewDate;
// get a pointer to the desired view (index 1) .. I know ... it's a constant ... 
returnDetailViewDate = [[[self navigationController] childViewControllers] objectAtIndex:1];
[returnDetailViewDate setPassedDate:datePicker.date];

don’t forget to add #import “DetailViewController.h” in your ChangeDateViewController.m :slight_smile:

Hope it will help !