presentPopoverFromRect 中的宽度和高度?
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在
UIPopoverController
对象上调用setPopoverContentSize:animated:
方法,这将设置弹出窗口的高度和宽度。UIPopoverController 的位置由
presentPopoverFromRect:inView:permissedArrowDirections:animated:
方法控制。Call the
setPopoverContentSize:animated:
method on yourUIPopoverController
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.这很令人困惑,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!