UISearchDisplayController灰色叠加不完全覆盖表 [英] UISearchDisplayController gray overlay not fully covering table

查看:130
本文介绍了UISearchDisplayController灰色叠加不完全覆盖表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题是,当显示键盘时,自动放在我的UISearchDisplayController上的灰色叠加层并不总是完全覆盖桌面区域(您可以在下图中看到底部的白色)。这并不总是发生,但它足够频繁,令人讨厌。有谁知道发生了什么事?谢谢。

I'm having an issue where the gray overlay that's automatically put over my UISearchDisplayController when the keyboard is shown doesn't always fully cover the table area (you can see the white on the bottom in the picture below). This doesn't always happen but it's frequent enough that it's annoying. Anyone know what's going on? Thanks.

推荐答案

我相信这是Apple代码中的一个错误。在与UIPopoverControllers广泛合作之后,我发现在执行大小调整计算时,很多时候popover会对是否有导航栏感到困惑。

I believe this is a bug in Apple's code. Having worked extensively with UIPopoverControllers, I have found that there are many occasions in which a popover becomes confused as to whether or not it has a navigation bar when performing sizing calculations.

我相信,如果你测量白盒的高度,你会发现它正好是37像素:弹出窗口中导航栏的高度。 (弹出窗口中的导航栏不像大多数导航控制器那样高44像素,因为它们嵌入到弹出框的边框中。)

I am confident that if you measure the height of the white box you will find that it is exactly 37 pixels: the height of a navigation bar in a popover. (Navigation bars in popovers are not 44 pixels high like most navigation controllers since they are embedded into the popover's border.)

如果你能够访问灰色叠加并手动调整大小你可以考虑导航栏的高度或缺少。不幸的是,你有点绑定,因为叠加层是由搜索栏控制的。

If you were able to access the gray overlay and manually resize it you could account for the height of the navigation bar or lack thereof. Unfortunately you are in a bit of a bind since the overlay is controlled by the search bar.

我的建议是尝试让popover重新计算它的大小显示或调整大小后的内容。当动态调整包含导航栏的UIPopover时,我会使用此模式:

My suggestion would be to try to get the popover to recompute the size of its contents after it appears or is resized. I use this pattern when dynamically resizing a UIPopover containing a navigation bar when it appears:

// UIViewController subclass with a navigation bar which is displayed in a popover
// _popoverController is a (unretained) pointer to the UIPopoverController in which this view controller is displayed

- (void)viewDidLoad 
{
    [self.view sizeToFit];

    CGSize newSize; // Dynamically computed based on popover contents
    self.contentSizeForViewInPopover = newSize;
    newSize.height += 37; // Account for popover navigation bar
    [_popoverController setPopoverContentSize:size animated:YES];
}

我不知道这个答案会有多大帮助,但我希望它至少能给出你正朝着正确的方向前进。

I don't know how much this answer will help, but I hope it will at least give you a push in the right direction.

这篇关于UISearchDisplayController灰色叠加不完全覆盖表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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