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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信这是苹果代码中的一个错误。在广泛使用 UIPopoverControllers 后,我发现在很多情况下,弹出窗口在执行大小计算时会混淆它是否有导航栏。
我相信,如果您测量白框的高度,您会发现它恰好是 37 像素:弹出窗口中导航栏的高度。 (弹出窗口中的导航栏不像大多数导航控制器那样高 44 像素,因为它们嵌入到弹出窗口的边框中。)
如果您能够访问灰色覆盖层并手动调整其大小,您可以考虑导航栏的高度或缺少导航栏的高度。不幸的是,由于覆盖层是由搜索栏控制的,因此您有点陷入困境。
我的建议是尝试让弹出窗口在出现或调整大小后重新计算其内容的大小。当动态调整包含导航栏的 UIPopover 的大小时,我会使用这种模式:
我不知道这个答案会有多大帮助,但我希望它至少会给您带来正确方向的推动。
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.
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.
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:
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.
看看这篇文章:http://www.cannonade.net/blog.php? id=1498
他讨论了这个问题,提供了一个(他自己称为)丑陋的解决方法,但也说明了如何解决它!
Have a look in this post: http://www.cannonade.net/blog.php?id=1498
He discusses the problem, providing a (called by himself) ugly workaround, but also says how to fix it!