首先,把UIDatePicker连线 @property (weak, nonatomic) IBOutlet UIDatePicker *datePicker; UIDatePicker控件有几种显示方式,我选择了年月日