gpt4 book ai didi

popover - iOS 8 - UIPopoverPresentationController 移动弹出窗口

转载 作者:行者123 更新时间:2023-12-01 16:51:16 25 4
gpt4 key购买 nike

我正在寻找一种有效的方法来使用新的 uipopoverpresentationcontroller 重新定位弹出框。我已经成功地呈现了弹出框,现在我想移动它而不需要再次关闭和呈现。我在使用该功能时遇到问题:

(void)popoverPresentationController:(UIPopoverPresentationController *)popoverPresentationController
willRepositionPopoverToRect:(inout CGRect *)rect
inView:(inout UIView **)view

我知道现在还处于游戏的早期阶段,但如果有人有一个如何有效地做到这一点的例子,如果您与我分享,我将不胜感激。提前致谢。

最佳答案

不幸的是,这个 hacky 解决方法是我找到的唯一解决方案:

[vc.popoverPresentationController setSourceRect:newSourceRect];
[vc setPreferredContentSize:CGRectInset(vc.view.frame, -0.01, 0.0).size];

这会暂时更改所呈现 View 的内容大小,导致弹出框和箭头重新定位。尺寸的临时变化是不可见的。

这似乎是苹果需要解决的一个问题 - 当它已经呈现一个弹出窗口(没有此解决方法)。

希望这也适合您!

关于popover - iOS 8 - UIPopoverPresentationController 移动弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24457063/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com