Gold challenge solution


I just solved the gold challenge. Pls examine the solution. Any improvement tips or suggestions would be welcome. Pls feel free to point out mistakes or shortcomings in the code or any implementation.


    DateViewController *dateViewController= [[DateViewController alloc] init];
    [self.navigationController pushViewController:dateViewController animated:YES];


#import <UIKit/UIKit.h>
@class BNRItem;
@interface DateViewController : UIViewController
   IBOutlet UIDatePicker *datePicker;
@property BNRItem *item;
@property NSDate *date;
#import "DateViewController.h"
#import "BNRItem.h"
@interface DateViewController ()


@implementation DateViewController
@synthesize item=_item;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    return self;

- (void)viewDidLoad
    NSLog(@"DateView loaded");
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSLog(@"DateView appeared");
    [super viewDidAppear];
    [datePicker setDatePickerMode:UIDatePickerModeDate];
    [datePicker addTarget:self action:@selector(configure) forControlEvents:UIControlEventValueChanged];
    NSLog(@"DateView disappeared");
    [super viewDidDisappear];
- (void)didReceiveMemoryWarning
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    NSLog(@"Date- %@",[datePicker date]);
    self.item->dateCreated= [datePicker date];

As you can see i did a target-action implementation using the addTarget:action:forControlEvents. Please tell me if this is a good enough approach to solving the challenge. There’s a thing that did not understand-The insurance fraud label that we had to put. Whats that all about?? One plus point that i have in this is that i need not have to update the dateLabel when i come back from DateViewController’s view to the DetailViewController’s view. Anyways any suggestions are welcome. :slight_smile:


Thanks for posting your solution. It really helped me understand what is going on in this challenge.