如何将日期格式更改为yy/mm/dd
?
这是我到目前为止所拥有的:
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
if (textField == _celebration)
{
UIDatePicker *datePicker = [[UIDatePicker alloc]init];
[datePicker setDate:[NSDate date]];
[datePicker addTarget:self action:@selector(updateTextField:) forControlEvents:UIControlEventValueChanged];
[self.celebration setInputView:datePicker];
}
}
- (void)updateTextField:(id)sender
{
UIDatePicker *picker = (UIDatePicker*)self.celebration.inputView;
self.celebration.text = [NSString stringWithFormat:@"%@",picker.date];
}