UIDatePicker not displaying wheel for day of the month (dd) on iPad for iOS 8.1

I had this same problem on an iPhone 5 running 9.0.1. The problem occurred in portrait orientation. I noticed that if I rotated the device to landscape mode, the date was drawn correctly. Moreover if I then rotated it back to portrait mode it then drew correctly.

I added the following two lines to my table view controller's viewDidLoad method:

    [self.tableView setNeedsLayout];

    [self.tableView layoutIfNeeded];

This fixed the problem - the date picker now draws correctly the first time in portrait mode.


I have been running into this same issue, the date picker months being cut off and the day of the month being invisible. None of the suggestions in this thread nor in this one: UIDatePicker Cutting Off Text & Not Displaying Days worked for me.

It started for me on iOS8. I am not using constraints. I'm not using storyboards, but I am using nib files to load the UI. My situation is on an iPad. I have a screen with a "view" mode. When a user taps a button, the view is faded out and an 'edit' mode view is faded in. The edit mode view is the same as the 'create' mode. The create mode (reached via another navigation path) doesn't cut off the date picker.

So, I just started doing crazy ideas to see if I could remove the glitch. In the end, this is my function for switching to edit mode:

//@extern
- (void) showAddEditModeUI {
    [self fadeInView:self.editMembershipView];

  //WORKAROUND - ios8 issue was cutting off the date picker in the middle
  //the solution in this stack overflow didn't work for me:
  //https://stackoverflow.com/questions/26352797/uidatepicker-not-displaying-wheel-for-day-of-the-month-dd-on-ipad-for-ios-8-1
  //but this did work
  UIDatePicker* dPicker = [[UIDatePicker alloc] initWithFrame:self.startDatePicker.frame];
  dPicker.date = self.startDatePicker.date;
  dPicker.datePickerMode = self.startDatePicker.datePickerMode;
  [self.startDatePicker removeFromSuperview];
  self.startDatePicker = dPicker;
  [self.editMembershipView addSubview:self.startDatePicker];

}

As you can see, I manually remove and re-add a UIDatePicker to the view. For whatever reason, this solved the issue. I am posting the answer here, just in case it helps someone else with this rather maddening problem.


try this

[myDatePicker setDatePickerMode:UIDatePickerModeDateAndTime];
[myDatePicker setDatePickerMode:UIDatePickerModeDate];

The problem seems to be associated with Autolayout. Please select the date picker in storyboard and add "Center Horizontly in container" constraint with UITableViewCell's content view. See the attached image for better understanding. https://puu.sh/cONRZ/a1f9d935b2.png

Required result after applying constraint;

https://puu.sh/cOO43/20947cf334.png

Without Constraints;

https://puu.sh/cOOnR/09f3ed8721.png

To add constraint, right click on the UIDatePicker while holding and drag the pointer to UITableViewCell's content view and release the pointer. Now select the "Center Horizontly in container" constraint. Please try and post in comments.