UIPopover without any arrows

前端 未结 17 1110
说谎
说谎 2020-12-08 02:15

Is it possible to present a popover without any sort of arrows pointing somewhere?

相关标签:
17条回答
  • 2020-12-08 02:31

    This works fine for me.

    [popoverController presentPopoverFromRect:CGRectMake(0, 0, 20, 20)
                                        inView:self.view 
                      permittedArrowDirections:NULL 
                                      animated:YES];
    

    Enjoy Coding.

    0 讨论(0)
  • 2020-12-08 02:36

    In swift 3, you can build a UIPopoverArrowDirection extension for this:

    extension UIPopoverArrowDirection {
        public static var noArrow: UIPopoverArrowDirection {
            return UIPopoverArrowDirection(rawValue: 0)
        }
    }
    

    and the you can do:

    popoverPresentationController!.permittedArrowDirections = .noArrow
    
    0 讨论(0)
  • 2020-12-08 02:40

    Do not use Popovers if you don't want to show arrows. Present your view controller as a Modal and use a UIModalPresentationFormSheet instead.

    Example:

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MyStoryBoard" bundle:nil];
    UIViewController* viewController = [sb instantiateViewControllerWithIdentifier:@"myViewController"];
    viewController.modalPresentationStyle = UIModalPresentationFormSheet;
    [presenterViewController presentViewController: viewController animated:YES completion:^{
    
    }];
    
    0 讨论(0)
  • 2020-12-08 02:41

    Set the permittedArrowDirections to 0.

    permittedArrowDirections:0
    

    Code -

    [self.popoverController presentPopoverFromBarButtonItem:anItem   
                                    permittedArrowDirections:0
                                                    animated:YES];
    

    Zero tells "NoDirection".

    0 讨论(0)
  • 2020-12-08 02:45

    Swift4:

    popover.permittedArrowDirections = []              
    
    0 讨论(0)
提交回复
热议问题