UIPopover without an arrow
- April 04, 2012
Ever wanted to place a UIPopover on a View but not have an arrow?
The UIPopoverDirectionArrowDirection enum is defined as
enum {UIPopoverArrowDirectionUp = 1UL << 0,UIPopoverArrowDirectionDown = 1UL << 1,UIPopoverArrowDirectionLeft = 1UL << 2,UIPopoverArrowDirectionRight = 1UL << 3,UIPopoverArrowDirectionAny = UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown |UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight,UIPopoverArrowDirectionUnknown = NSUIntegerMax};
Which doesn't include UIPopoverArrowDirectionNone, or does it?
There is an undocumented feature that if you call presentPopoverFromRect with a 0 for permittedArrowDirections, it will show no arrows. I'm not sure if this is 100% supported by Apple, but a trawl around the internet suggests that apps using this have been accepted.
So call the code like below, and hey presto! No arrows
[self.configPopover presentPopoverFromRect:CGRectMake(setupButton.center.x,
setupButton.center.y,
250, 200)
inView:self.view
permittedArrowDirections:0
animated:YES];
