iPad: Displaying UIActionSheet with UIPickerView as subview

Posted by E-Madd on Stack Overflow See other posts from Stack Overflow or by E-Madd
Published on 2010-12-30T17:50:54Z Indexed on 2010/12/30 17:54 UTC
Read the original article Hit count: 489

Filed under:
|
|

I'm in the process of migrating an iPhone app to a universal app. On one of my views, I present a UIActionSheet with a UIPickerView as a subview. On the iPhone this always worked just fine. Of course, on the iPad I had to change a little to present the ActionSheet in a popover control. Here's some psuedo-code to outline where I'm at...

actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil];

pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,44,0,0)];
pickerView.delegate = self;
pickerView.dataSource = self;
pickerView.showsSelectionIndicator = YES; 
[actionSheet addSubview:pickerView];

if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad){
    [actionSheet showInView:self.view];
    [actionSheet setBounds:actRect];
}else{
    [actionSheet showFromRect:buttonRect inView:[UIApplication sharedApplication].keyWindow animated:YES];
}

The resulting popover on the iPad is very small and only the very top of the UIPickerView is visible. How can I set the size of the popover?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ipad