Note that there are some explanatory texts on larger screens.

plurals
  1. POPickerView loaded via button click too small
    text
    copied!<p>I'm building an iPad app and I wish to popup a uipickerview when the user presses a button (a regular button, not a ToolBarItem). I realize that typically you do popover type things from a toolbar but in this instance I need it to happen on a standard button click. I've done quite a bit of search and this is the code I was able to come up with (this is the code for the Button click):</p> <pre><code>- (IBAction)showTagPicker:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select a Category" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; [actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; CGRect frame = CGRectMake(0, 40, 320, 450); PCCategory *categories = [[PCCategory alloc] init]; UIPickerView *picker = [[UIPickerView alloc] initWithFrame:frame]; picker.delegate = categories; picker.dataSource = categories; UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 464)]; pickerToolbar.barStyle = UIBarStyleBlackOpaque; [pickerToolbar sizeToFit]; NSMutableArray *barItems = [[NSMutableArray alloc] init]; UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; [barItems addObject:flexSpace]; UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(tagSelected)]; [barItems addObject:doneButton]; [pickerToolbar setItems:barItems animated:YES]; [actionSheet addSubview:pickerToolbar]; [actionSheet addSubview:picker]; [actionSheet showInView:self.view]; [actionSheet setBounds:CGRectMake(0, 0, 320, 464)]; } </code></pre> <p>This does seem to be creating the picker control in a popover, however the control is very small (its only displaying about 1 line) and none of the tool bar items I'm showing are rendering. </p> <p><a href="http://i.imgur.com/RCLKC.png" rel="nofollow">see picture</a></p> <p>How can I control the size? I've tried tweaking the values of the two CGRect objects that are being created but that doesn't seem to make much of a difference.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload