UIPopoverController 锚点位置 [英] UIPopoverController Anchor Position

查看:42
本文介绍了UIPopoverController 锚点位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIPopOverController,它的内容控制器是一个 UINavigationController.我正在根据推入/弹出的控制器的内容大小调整弹出框的大小.最初,我使用 presentPopoverFromRect:inView:permittedArrowDirections:animated: 方法来呈现弹出框.锚点位置指向我作为参数传递的矩形的中心.如果我将一个控制器(其内容大小很小)推入 navigationController ,则弹出框会从底部缩小并移动到我之前提到的矩形上方.

我每次都尝试呈现弹出框(用于推送/弹出),锚点位置保持@相同点但动画受到影响,看起来不太好.

需要做什么才能使锚点位置保持不变,而不管弹出框大小变化如何变化?

解决方案

我也遇到了同样的问题,好像再次调用 presentPopoverFromRect 方法会使锚点保持在同一位置

例如

[self.myPopOver presentPopoverFromRect:rectOrigin inView:self.view allowedArrowDirections:UIPopoverArrowDirectionAny animation:NO];

希望它也适用于您的情况

I have a UIPopOverController for which the content controller is a UINavigationController. I'm resizing the popover size according to the content size of the controller pushed/popped into it. Initally i'm presenting the popover by using the method presentPopoverFromRect:inView:permittedArrowDirections:animated:. The anchor position is pointing at the center of the rect which i passed as an argument. If i push a controller(whose content size is small) into the navigationController , the popover shrinks from the bottom and moves above the rect which i mentioned earlier.

I tried to present the popover everytime(for push/pop) , anchor position remains @ same point But the animation gets affected , doesnt looks good.

what needs to be done to make the anchor position remains same irrespective of the change in popover size variation ?

解决方案

I've encountered the same issue and it seems that calling the presentPopoverFromRect method again will keep the anchor at the same position

e.g.

[self.myPopOver presentPopoverFromRect:rectOrigin inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:NO];

Hope it works in your case as well

这篇关于UIPopoverController 锚点位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆