UIPopover without any arrows

Is it possible to imagine a popover without any arrows pointing somewhere?

+44
uikit ipad uipopovercontroller
Aug 03 '10 at 21:24
source share
15 answers

Yes, you can simply do:

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

Zero does not indicate direction.

+90
02 Sep 2018-10-09T00:
source share

For iPhone and Quick 2.0, try this

Code to run popover

 initiatePopover(){ let popoverContent = self.storyboard?.instantiateViewControllerWithIdentifier("XYZController") as! XYZController let nav = UINavigationController(rootViewController: popoverContent) nav.modalPresentationStyle = UIModalPresentationStyle.Popover let popover = nav.popoverPresentationController popoverContent.preferredContentSize = CGSizeMake(250 ,200) popover!.delegate = self popover!.sourceView = self.view popover!.sourceRect = CGRectMake(200,200,0,0) popover!.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0) self.presentViewController(nav, animated: true, completion: nil) } 

And add this to your ViewController

 func adaptivePresentationStyleForPresentationController(controller: UIPresentationController) -> UIModalPresentationStyle { return UIModalPresentationStyle.None } 
+18
Oct 09 '15 at 9:40
source share

Set permittedArrowDirections to 0.

 permittedArrowDirections:0 

The code -

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

Zero indicates "NoDirection".

+8
Sep 12 '11 at 9:45 a.m.
source share

Try it, it works for me.

 [self.popoverViewController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:0 animated:YES]; 
+4
Jul 07 '11 at 7:08
source share

For Swift 2.0 and iOS9 solution:

 popoverViewController?.permittedArrowDirections = UIPopoverArrowDirection() 
+4
Jan 28 '16 at 11:36
source share

Swift3 , this code works for me

 popover.permittedArrowDirections = .init(rawValue: 0) 
+4
Jan 19 '17 at 10:31 on
source share

This works great for me.

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

Enjoy the coding.

+3
Jul 10 '13 at 9:52 on
source share

No, there is no UIPopoverArrowDirectionNone option, and UIPopoverArrowDirectionUnknown throws an exception, which I think if you try to use it to represent.

Instead of a popover controller, you can call presentModalViewController:animated: and set the controller you represent for the modal presentation style to UIModalPresentationFormSheet or, possibly, UIModalPresentationPageSheet . These are more traditional pop-ups than popovers.

+2
Aug 04 '10 at 18:38
source share

Try this one

 [popOverController presentPopoverFromRect:CGRectMake(0, 0, 30, 40) inView:popOverContentView permittedArrowDirections:0 animated:NO]; 
+1
Dec 03 '12 at 11:30
source share

I use popover to display the menu depending on the coordinate of the touch. In this case, popover uses the maximum height of self.view

 CGRect popeverFrame = CGRectMake(touchPoint.x, touchPoint.y, 0, 0); [self.popover presentPopoverFromRect:popeverFrame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

But when I use 0-direction. The Popover rectangle does not set the maximum height and can only be set with the corresponding property.

 CGRect popeverFrame = CGRectMake(touchPoint.x, touchPoint.y, 0, 0); [self.popover presentPopoverFromRect:popeverFrame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

Hope this helps: UIPopOverController size help

+1
Aug 27 '13 at 5:58
source share

Do not use Popovers if you do not want to show arrows. Present your presentation controller as Modal and use the UIModalPresentationFormSheet instead.

Example:

 UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MyStoryBoard" bundle:nil]; UIViewController* viewController = [sb instantiateViewControllerWithIdentifier:@"myViewController"]; viewController.modalPresentationStyle = UIModalPresentationFormSheet; [presenterViewController presentViewController: viewController animated:YES completion:^{ }]; 
+1
Jul 14 '14 at 16:10
source share

In my case, for quick developers

 popoverController.sourceView = self.view popoverController.sourceRect = self.view.bounds popoverController.backgroundColor = UIColor.brownColor() popoverController.permittedArrowDirections = UIPopoverArrowDirection.init(rawValue: 0) popoverController.sourceRect = CGRectMake(width/4, hieght/4, width/2, hieght/2); 
+1
Apr 14 '16 at 11:18
source share

In quick version 3, you can build the UIPopoverArrowDirection extension for this:

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

and you can do:

 popoverPresentationController!.permittedArrowDirections = .noArrow 
+1
Mar 18 '17 at 10:42 on
source share

To create a kiss direction of none and make it appear in the center of the view controller:

 let PopSrnVar = popoverPresentationController let ConRctVar = view.frame PopSrnVar!.sourceRect = CGRectMake(ConRctVar.width/4, ConRctVar.height/4, ConRctVar.width/2, ConRctVar.height/2) // To make arrows as none PopSrnVar!.permittedArrowDirections = UIPopoverArrowDirection() 
0
Sep 30 '16 at 12:33
source share

Simple solution in SWIFT:

 popover!.permittedArrowDirections = nil 
-2
May 27 '15 at 10:44
source share



All Articles