Search code examples
iosuipopovercontroller

UIPopoverController permitted arrow directions issues


I have an UIPopoverController that has to shows with the arrow direction up, but when I try to show popover in the bottom of view I see this:

enter image description here

[popoverController presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

Solution

  • You need to use UIPopoverArrowDirectionDown in this case. Since the button is in the bottom area of the view, if you want to show the popover below the button (that is what UIPopoverArrowDirectionUp suggests implicitly), it doesn't have any space to show the pop over.

    If you use UIPopoverArrowDirectionAny, then iOS automatically figures out which way it can extend.