I have created an applicaiton on iPhone, now I want to fit UIDatePicker into the UIActionSheet. I have created a button to show actionSheet. Unfortunately it gets cropped off and the entire Date Picker is not visible. I have not even attempted to add the UIButton yet. Can anyone suggest on getting the entire view to fit properly? I'm not sure how to add the proper dimensions as UIActionSheet seems to lack an -initWithFrame: type constructor.
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:
@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;
[actionSheet addSubview:pickerView];
[actionSheet showInView:self.view];[pickerView release];
[actionSheet release];
I also try with some other code like this:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:CGRectMake(150.0, 150.0, 70.0f, 70.0f)];
The coords are ofcourse not realistic, but they don't seem to affect the position/size of the UIActionSheet.
Tarun Kumar
15-Dec-2015I get a solution of my code that I asked we can solve this like that:
But it will better to create a fullscreen view with a UIDatePicker and a navigation bar. For an example see UICatalog -> Pickers sample from the iPhone DevCenter.