Confused about Gold solution


#1

Hi in my gold solution,
I have such code:

[code]#import <UIKit/UIKit.h>
#import “BNRItem.h”

@interface DateViewController : UIViewController
{
__weak IBOutlet UIDatePicker *datePicker;
}

@property (nonatomic, strong) NSDate *userDate;
@property (nonatomic, strong) BNRItem *item;

@end[/code]

If I use this approach:

DateViewController

[code]- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"%@", [datePicker date]);

item.dateCreated = [datePicker date];

}[/code]

DetailViewController

[code]- (IBAction)changeDate:(id)sender {

DateViewController *vc = [[DateViewController alloc] init];

[vc setItem: item];


[[self navigationController] pushViewController:vc animated:YES];

}[/code]

Everything works. If use this approach the date is not reflected when user comes back to the DetailsViewController - can someone please explain why?

(this approach doesn’t work)

inside DateViewController:

[code]- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"%@", [datePicker date]);

userDate = [datePicker date];

}[/code]

inside: DetailViewController:

[code] - (IBAction)changeDate:(id)sender {

DateViewController *vc = [[DateViewController alloc] init];

 vc.userDate = item.dateCreated;

[[self navigationController] pushViewController:vc animated:YES];

}[/code]