0

I have a date picker which is supposed to switch from UIDatePickerModeDateAndTime to UIDatePickerModeTime and vice-versa, depending on the selected table view cell. When the view gets loaded the default mode is UIDatePickerModeDateAndTime, and I can change the picker value without any problem. But after selecting the next cell the UIDatePickerModeTime is set, and from this point on it isn't longer possible to change the picker's value: it crashes with EXC_BAD_ACCESS and no log whatsoever.

Below the significant code:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  if (indexPath.row == 0) {
    self.dateTimePicker.minimumDate = [NSDate date];
    self.dateTimePicker.datePickerMode = UIDatePickerModeDateAndTime;
  }
  else {
    self.dateTimePicker.minimumDate = nil;
    self.dateTimePicker.datePickerMode = UIDatePickerModeTime;
  }
}

What am I missing here?

Thanks in advance.

Tiago Fernandez
  • 1,453
  • 3
  • 19
  • 36

1 Answers1

0

There was nothing wrong with my code, it was a bug of iOS 6 beta 3.
It got automatically fixed once I've installed the final iOS 6.0 release.

Tiago Fernandez
  • 1,453
  • 3
  • 19
  • 36