I'm implementing a table view where for one particular table view cell, there is a textfield whose first responder needs to be a UIDatePicker. I've been able to implement most of it, but for some reason the view is not appearing completely correct. I've been stuck on this problem for a while and I've been looking at this answer for help.
UIDatepicker in UItextfield in UItableView
As of now, I have the data picker appearing and disappearing properly, the delegate for the text field is working properly, and the textfield can be updated. My problem is that for some reason the Month component of the date picker is missing (I have a picture, but since I have less than 10 rep, I can't post it). What it looks like is a typically UIDatePicker but the first component that has the months, is completely empty and can't scroll. The day and year components operate normally.
This is how I create the picker view
cell = [tableView dequeueReusableCellWithIdentifier:InfoIdentifier];
UILabel *textLabel = (UILabel *)[cell viewWithTag:kInfoLabelTag];
UITextFieldWithIndex *cellText = (UITextFieldWithIndex *)[cell viewWithTag:kInfoTextboxTag];
cellText.indexPath = indexPath;
textLabel.text = @"Birthday";
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
datePicker.tag = indexPath.row;
cellText.inputView = datePicker;
And here is the callback method
-(void)datePickerValueChanged:(id)sender {
NSLog(@"Date Changing");
currentTextField.text = @"new date";
}
Resigning the first responder works, and if I print the date, the month is present, so the only problem is that the month labels are missing.
I created this project using Storyboards, and I am also using core date in this project. However, the core data part of this view controller hasn't been implemented yet.
Any ideas?