0

I am displaying a popover to be presented in a view but leaving some space at the top.

I am using presentPopoverFromrect:inView:permittedArrowDirections: but apart from passing the view I also want to restrict the popover within the view within a rectangle.

which means , the popover should not go outside this rect in the view and also adjust arrows accordingly. Is there a way that this can be made possible ?

Amogh Talpallikar
  • 12,084
  • 13
  • 79
  • 135

3 Answers3

0

Overwrite contentSizeForPopover and make it return the values you need.

- (CGSize)contentSizeForViewInPopover
{
    return CGSizeMake(180, 360);
}
Hermann Klecker
  • 14,039
  • 5
  • 48
  • 71
0

Make the xib size freeform and remove the status bar first .then what ever value set for the view in xib make it the viewdidload as

[self setContentSizeForViewInPopover:CGSizeMake(widthsetinxib, heightsetinxib)];
Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
0

You need to set the 'popoverLayoutMargins' property of UIPopover. Like so -

[myPopoverController setPopoverLayoutMargins:UIEdgeInsetsMake(top, left, bottom, right)];

This restricts the popover to the specified insets. For details read the documentation of the same method.

P.S. I know this is a very late answer for the question, but I just faced and solved the same issue, so I can vouch for this solution.

Chris
  • 8,527
  • 10
  • 34
  • 51