Gold Challenge - Solution


I re-declared item in BNRItem as property so that both getter and setter are available to us. Manual getter/setter look ugly IMO.

@property (strong, nonatomic) NSDate *dateCreated;
Add another ViewController BNRDateChanger:


#import <UIKit/UIKit.h>
@class BNRItem;

@interface BNRDateChanger : UIViewController
@property (strong, nonatomic) BNRItem *item;



[code]#import "BNRDateChanger.h"
#import "BNRItem.h"
#import "BNRDetailViewController.h"

@interface BNRDateChanger ()
@property (weak, nonatomic) IBOutlet UIDatePicker *datePicker;


@implementation BNRDateChanger

- (void)viewDidLoad
	[self.datePicker addTarget:self action:@selector(updateDate:) forControlEvents:UIControlEventValueChanged];


- (void)updateDate:(id)obj
	BNRItem *item = self.item;
	item.dateCreated =;


In BNRDetailsViewController:

- (IBAction)changeDate:(id)sender { BNRDateChanger *dateChanView = [[BNRDateChanger alloc] init]; dateChanView.item = _item; [self.navigationController pushViewController:dateChanView animated:YES]; }

Good Fun! :smiley:


I think something is missing in your solution. Where does UpdateDate() get called? Do I need to change something in BNRDetailViewController.xib or what?