I am trying to put a UIDatePicker view into a UIActionSheet. You can see the problem I am running into here. Even without the keyboard there, you can still see through that spot to the background. I included the code below which is called when the user taps a button on the screen. To clarify, the view controller that is the background is a modal view controller with its own navigation hierarchy. Additionally to this question (this isn't as important), but I would like to move the two selection buttons below the date picker. Is there an easy way to do that?
//How I initialized the action sheet
dateActionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose Date" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Done", nil];
//This code gets called when the user taps a button on the screen
datePicker.datePickerMode = UIDatePickerModeDate; //UIDatePicker datePicker
[dateActionSheet addSubview:datePicker];
[dateActionSheet showInView:self.view];
CGRect menuRect = dateActionSheet.frame;
CGFloat orgHeight = menuRect.size.height;
menuRect.origin.y -= 214; //height of picker
menuRect.size.height = orgHeight+214;
dateActionSheet.frame = menuRect;
CGRect pickerRect = datePicker.frame;
pickerRect.origin.y = orgHeight;
datePicker.frame = pickerRect;
From the UIActionSheet class reference:
UIActionSheet
is not designed to be subclassed, nor should you add views to its hierarchy.
Instead, create your own view, or use a third-party library like RMDateSelectionViewController.