我在我的应用程序的日期选择器中设置了初始日期。如果我更改值并选择它会拾取它,但是在选择值而不更改旋转器时,它显示的值是今天的日期。
我一直在尝试使用 [UIDatePicker setDate:] 方法,但是我遇到了问题,它不会设置。这是我“选择”日期的代码(分配给按钮的操作):
- (IBAction)backToMap:(id)sender {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
FirstViewController *fvc = [storyboard instantiateViewControllerWithIdentifier:@"FirstViewController"];
fvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
datePicked = [datePicker date];
self.firstViewData = fvc;
fvc.passedData = datePicked;
// if isPickerType = 1 then it is date and time
// if isPickerType = 2 then it is just date
fvc.datePicker = isPickerType;
[self presentViewController:fvc animated:YES completion:nil];
}