Satyam
Satyam

Reputation: 15894

iPad - Showing action sheet with picker view

I'm adding picker view to action sheet which is working fine in iPhone. But in iPad, i'm not seeing the action sheet. I'm seeing one small rectangle at the middle of the screen in iPad. Here's the code that I wrote:

    NSString *actionSheetTitle = @"Select Date of Birth";
    UIActionSheet *dateSheet = [[UIActionSheet alloc] initWithTitle:actionSheetTitle
                                                                         delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
                                                                otherButtonTitles:@"Done",nil];
    dateSheet.delegate = self;
    dateSheet.actionSheetStyle = UIActionSheetStyleAutomatic;
    dateSheet.destructiveButtonIndex = 0;    // make the second button red (destructive)
    dateSheet.tag = 100;

    //Add the picker
    UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0,185,0,0)];
    pickerView.datePickerMode = UIDatePickerModeDate;
    [pickerView addTarget:self action:@selector(dateSelectionChanged:) forControlEvents:UIControlEventValueChanged];
    [dateSheet addSubview:pickerView];
    [dateSheet showInView:self.view];
    [dateSheet setBounds:CGRectMake(0,0,320,700)];

    self.tempDob = self.dob;
    if (self.editPatientDetails)
    {
        NSDateFormatter* dtFormatter = [[NSDateFormatter alloc] init];
        [dtFormatter setDateFormat:@"MM/dd/yyyy"];
        NSDate* dateSelected = [dtFormatter dateFromString:self.dob];
        [dtFormatter release];
        [pickerView setDate:dateSelected animated:YES];     
    }

    [pickerView release];
    [dateSheet release];    

Upvotes: 0

Views: 524

Answers (1)

Satyam
Satyam

Reputation: 15894

Action sheet is shown as picker view in iPad. Its the expected behavior.

Upvotes: 1

Related Questions