iPad: Displaying UIActionSheet with UIPickerView as subview
- by E-Madd
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?