如何使用presentPopoverFromRect制作弹出框和箭头?

发布于 2024-09-04 07:31:09 字数 128 浏览 2 评论 0原文

我不明白如何定义 (CGRect)rect 来控制弹出框的位置和箭头的位置。

例如,我有一个 1004 x 768 视图,如何将弹出窗口放在屏幕右下角,并将箭头指向 700 (x) 1000 (y)?

I don't understand how to define the (CGRect)rect in order to control the position of popover, and the position of the arrow.

For example, I have a 1004 x 768 view, how can I put the popover at lower right of the screen, and point the arrow at 700 (x) 1000 (y)?

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

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

发布评论

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

评论(2

做个少女永远怀春 2024-09-11 07:31:09

Nickthedude 关于presentpopoverfromrect 的说法是正确的,但是presentpopoverfromrect 函数有一个重要的时刻:如果您没有设置popover 的contentSizeForViewInPopover 属性,它将使用默认值 - 320*1100 点。如果您的弹出框的矩形不适合屏幕坐标(您的坐标是从当前弹出框的矩形中获取的),系统会将您的弹出框放置到它认为更理想的矩形中。

Nickthedude is right about presentpopoverfromrect, but there is one essential moment with presentpopoverfromrect function: if you don't set popover's contentSizeForViewInPopover property it use defult values - 320*1100 points. And if you popover's rect doesn't fit into screen coordinates (with your coordinates got from the presentpopoverfromrect rect), system places your popover to rectangle which it considered as more optimal.

悲喜皆因你 2024-09-11 07:31:09

Cgrectmake(700,1000,10,10) 和 uipopoverarrowdirectionleft 抱歉,我在 iPad 上,所以我无法编写确切的代码,但将它们作为您的 presentpopoverfromrect 方法的参数传递。唯一的问题是我认为你太偏右了,无法在那里放置弹出窗口,除非我不理解你的问题。

Cgrectmake(700,1000,10,10) and uipopoverarrowdirectionleft sorry I'm on my iPad so I can't write the exact code but pass those in as the arguments for your presentpopoverfromrect method. The only thing is i think you're too far to the right to put a popover there unless I'm not understanding your question.

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