我可以更改 UIPopover 动画锚点吗?
我正在尝试使用 UIPopover 实现“下拉”菜单效果。当我将高度从 0px 更改为 500px 时,它似乎向上拉伸 250px,向下拉伸 250px...本质上是将 UIPopover 锚定在中心的原始生成点。我希望锚点位于弹出窗口的顶部,这样当我调整大小时,窗口的底部就会向下动画。
我注意到如果您将 UIPopover 移动到屏幕顶部,这种情况会自动发生。但是当它显示死点时如何才能达到相同的效果呢?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用:
presentPopoverFromBarButtonItem:permissedArrowDirections:animated:
或者
presentPopoverFromRect:inView:permissedArrowDirections:animated:
并尝试将 UIPopoverArrowDirectionUp 作为 permissedArrowDirection
arrowDirections
箭头指示弹出窗口被允许使用。您可以使用此值强制弹出框位于矩形的特定一侧。但是,通常最好指定 UIPopoverArrowDirectionAny 并让弹出框决定最佳位置。您不得为此参数指定 UIPopoverArrowDirectionUnknown。
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.