ActionSheetPicker-3.0: ActionSheetStringPicker not working on iPad (only iPhone)

When I call ActionSheetStringPicker on the iPad the screen fades, but the selection won’t show up. It just works on my iPhone.

Here follows the code:

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    if(textField.tag == 200){
        NSMutableArray *groups = [[NSMutableArray alloc] init];

        for (Group *group in [Group sharedUserGroups]) {
            [groups addObject:group.name];
        }

        [ActionSheetStringPicker showPickerWithTitle:@"Select a Group"
                                                rows:groups
                                    initialSelection:0
                                           doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
                                                textField.text = selectedValue;
                                                }
                                         cancelBlock:^(ActionSheetStringPicker *picker) {
                                             NSLog(@"Block Picker Canceled");
                                         }
                                              origin:self.view];

screen shot 2015-03-26 at 4 59 17 pm screen shot 2015-03-26 at 4 59 55 pm

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 41 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Ran into the same issue. The #187 fix did not work. Complete fix for me. (same position as the #187 fix)

  NSParameterAssert(popover != NULL);
    if (self.barButtonItem) {
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        {
            [popover presentPopoverFromBarButtonItem:_barButtonItem permittedArrowDirections:UIPopoverArrowDirectionAny
                                        animated:YES];
        }else{
            [popover presentPopoverFromRect:CGRectMake(_containerView.frame.size.width / 2.f, _containerView.frame.size.height, 0, 0) inView:_containerView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        }
        return;
    }
    else if ((self.containerView)) {
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
        {
        dispatch_async(dispatch_get_main_queue(), ^{
            [popover presentPopoverFromRect:_containerView.bounds inView:_containerView
                   permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

        });
        }else{
            [popover presentPopoverFromRect:CGRectMake(_containerView.frame.size.width / 2.f, _containerView.frame.size.height, 0, 0)inView:_containerView
                   permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        }
        return;
    }

Yes, I replaced the mentioned code part. I’m sorry, I tested both versions right now, but in this case it didn’t really change the outcome. I assume my Problem was definitely just the wrong origin.