NSDate - 从自定义操作表日期选择器获取日期

时间:2014-11-24 04:46:08

标签: ios datepicker nsdate

如何通过点击DatePicker的操作表中的完成按钮来访问日期:

 -(IBAction)doneBtnClick:(id)sender{   

 ......  
     else if([sender tag]==203)  
     {  
         NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear fromDate:pickerDate.date];  

         NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];  
         [dateFormat setDateFormat:@"dd MMM yyyy"];  

    //[self.lblDateSelected setAttributedText:strDate];

    //[pickerDate setDate:[NSDate date]];


           model.items.purchaseDate = [pickerDate setDate:[NSDate date]];  //error here!  

purchaseDate的类型为NSDate。

0 个答案:

没有答案