弹出窗口不规则地调整大小

发布于 2024-10-03 23:46:16 字数 511 浏览 2 评论 0原文

我在 UIPopoverController 中有一个 UITabBarController,我仅从一个 UIBarButtonItem 显示它。显示时,我希望弹出窗口占据允许的最大垂直高度。如果我点击显示它,然后关闭,然后旋转,效果很好。但是,如果我将弹出框以横向显示,然后旋转到纵向,它不再会填充整个垂直距离。我将选项卡栏控制器的内容大小属性设置为 320 x 1000,我什至尝试在每次设备旋转时重置它。更糟糕的是,当用户激活搜索栏时,弹出窗口会缩小得非常小,并保持这种状态直到应用程序重新启动。

http://cl.ly/3JdChttp://cl.ly/3JdC

还有http://cl.ly/3JVF

我怎样才能阻止这个,并使弹出窗口始终填满最大垂直尺寸?

I have a UITabBarController inside a UIPopoverController, which I am displaying solely from one UIBarButtonItem. When shown I want the popover to take up the maximum vertical height allowed. It works fine if I tap to display it, then dismiss, and then rotate. However if I have the popover displayed in landscape, and then rotate to portrait, it no longer will fill the entire vertical distance. I have the tab bar controller's content size property set to 320 by 1000, and I have even tried resetting this every time the device rotates. Worse yet, when the user activates the search bar the popover shrinks up extremely small, and stays that way until the app is restarted.

http://cl.ly/3JdC to http://cl.ly/3JdC

Also http://cl.ly/3JVF

How can I stop this, and have the popover always fill up the max vertical size?

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

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

发布评论

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

评论(1

公布 2024-10-10 23:46:16

我遇到了同样的问题,发现只有当我使用该方法呈现 UIPopoverController 时才会发生这种情况:

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

但当我使用时它工作正常:

- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

不幸的是 UIBarButtonItem 没有您可以与最后一个方法一起使用的框架矩形,因此我的解决方法是使用 UIToolbar 的框架并修改frame.origin.x 和frame.size。 width 相应地使弹出窗口出现在 UIBarButtonItem 旁边的正确位置。

希望苹果能够在下一版本的 iOS 中修复这个问题。

问候

I was just having the same problem and found out that it only happens when I present the UIPopoverController using the method:

- (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

but it works fine when I use:

- (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated

Unfortunately UIBarButtonItem does not have a frame Rect you can use with this last method so my fix was to use the UIToolbar's frame and modify frame.origin.x and frame.size.width accordingly to make the popover appear on the right place next to the UIBarButtonItem.

Hopefully Apple will fix this in next releases of iOS.

Regards

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