After recently downloading the latest Xcode update, when I rebuilt my application, unfortunately my UIDatePicker disappeared. When I originally created the app, I added the UIDatePicker programmatically and never included it as part of my XIB file. Maybe this has something to do with the new constraint requirements?
Here is the code where it was being programmatically added before, which did work until last Xcode update:
- (void) showDatePicker{
CGRect pickerFrame = CGRectMake(0,250,325,0);
datePicker = [[UIDatePicker alloc] initWithFrame:pickerFrame];
[datePicker addTarget:self action:@selector(pickerChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:datePicker];
// [scrollView addSubview:datePicker];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
df.dateStyle = NSDateFormatterMediumStyle;
datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker release];
[df release];
}
The problem is this line:
CGRect pickerFrame = CGRectMake(0,250,325,0);
That last 0
is the height of the picker. You are setting this view's height to zero. A zero-height view is invisible.