开发者

Can I change the UIPopover animation anchor point?

I'm attempting to achieve a "drop down" menu effect with a UIPopover. When I change the height from 0px to 500px it appears to stretch 250px up and 250px down... essentially anchoring the UIPopover at the original spawn point on center. I would like the anchor to be the top of the popover, so that when I adjust the size it is the bottom of the window that animates downwards.

I've noticed this happens automatically if you move the UIPopover to the top the screen. But 开发者_运维问答how can I achieve the same effect when it's displaying dead center?


Try to use:

presentPopoverFromBarButtonItem:permittedArrowDirections:animated: or presentPopoverFromRect:inView:permittedArrowDirections:animated:

and try UIPopoverArrowDirectionUp as permittedArrowDirection


arrowDirections

The arrow directions the popover is permitted to use. You can use this value to force the popover to be positioned on a specific side of the rectangle. However, it is generally better to specify UIPopoverArrowDirectionAny and let the popover decide the best placement. You must not specify UIPopoverArrowDirectionUnknown for this parameter.


What about creating your own popover? I mean, something that looks like the original popover but has the behavior you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜