presentPopoverFromRect 中的宽度和高度?

发布于 2024-11-17 06:25:54 字数 426 浏览 4 评论 0原文

presentPopoverFromRect:inView:permissedArrowDirections:animated: 中,UIPopoverViewController 的方法中,对于“presentPopoverFromRect”,我所理解的是“x”和“y” >” 是哪里它会指向它的锚点,但是“宽度”和“高度”参数会做什么呢?

我通过设置不同的值来玩它们,结果非常令人困惑。

In presentPopoverFromRect:inView:permittedArrowDirections:animated:, method of UIPopoverViewController, for "presentPopoverFromRect", what I have understood is that "x" and "y" are where it will point its anchor but what "width" and "height" parameter will do?

I am playing with them by setting different values and result is very confusing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

走野 2024-11-24 06:25:54

UIPopoverController 对象上调用 setPopoverContentSize:animated: 方法,这将设置弹出窗口的高度和宽度。

UIPopoverController 的位置由 presentPopoverFromRect:inView:permissedArrowDirections:animated: 方法控制。

Call the setPopoverContentSize:animated: method on your UIPopoverController object, and that will set the height and width of your popover.

The position of the UIPopoverController is controlled by the presentPopoverFromRect:inView:permittedArrowDirections:animated: method.

绅士风度i 2024-11-24 06:25:54

这很令人困惑,Apple 文档并没有使它变得更清晰:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html

奥特让您朝着正确的方向前进...presentPopoverFromRect 使用 CGRect 对象作为其锚点。我通过阅读其他帖子了解到,该矩形的中心用作 UIPopoverController 的锚点位置,而不是其 x,y 坐标。不过,我不确定这是否会根据 allowedArrowDirections 的不同而变化(我为此使用零)。所有苹果文档都说“视图中锚定弹出窗口的矩形”。

为了使其几乎像点坐标一样运行,我一直使用 width=1 和 height=1 作为锚点矩形大小。

希望有帮助!

This is confusing, and the Apple documentation doesn't make it any clearer:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html

ott started you in the right direction... presentPopoverFromRect uses a CGRect object as its anchor. What I learned by reading other posts here, is that the CENTER of that rectangle is used as the anchor position for the UIPopoverController, not its x,y coordinates. Although, I'm uncertain whether that varies based on permittedArrowDirections (I'm using zero for that). All the apple documentation says is "The rectangle in view at which to anchor the popover window."

To make it operate nearly like point coordinates, I've been using width=1 and height=1 for my anchor rect size.

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文