title: how to assign selected date from UIDatePicker in ios
body: <pre><code>- (void)viewDidLoad
  {
   [super viewDidLoad];
   UIDatePicker *datepicker = [[UIDatePicker alloc] init];
  
   datepicker.datePickerMode = UIDatePickerModeDate;
  
   [datepicker addTarget:self action:@selector(date)   forControlEvents:UIControlEventValueChanged];
  
   self.birthDay.inputView = datepicker;
  }
  
  
  -(void)date
  {
  
   NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  
   [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
  
   self.birthDay.text = [dateFormatter stringFromDate:[self.datepicker date]];
  }
  </code></pre>