showsScopeBar = YES时,iOS8上的UISearchBar高度 [英] UISearchBar height on iOS8 when showsScopeBar=YES

查看:325
本文介绍了showsScopeBar = YES时,iOS8上的UISearchBar高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中使用 UISearchBar showsScopeBar = YES 。当在iOS8下运行时(在模拟器和设备上),范围栏被隐藏,搜索栏的高度保持在44而不是预期的88.在Xcode 6中使用新的视图调试器我可以看到范围栏实际上是现在,但仍然隐藏在文本字段后面。

I'm using UISearchBar in my app, with showsScopeBar=YES. When running under iOS8 (both in the simulator and on a device) the scope bar is hidden and the search bar's height remains at 44 instead of the expected 88. Using the new view debugger in Xcode 6 I can see that the scope bar is actually present, but remains hidden behind the text field.

我到目前为止找到的唯一方法是手动将搜索栏的高度设置为88,当然这是一个糟糕的黑客。

The only way I've found so far is to manually set the search bar's height to 88, which of course is a terrible hack.

我是否遗漏了一些文件记录的不兼容性,或者这是一个错误?

Am I missing some documented incompatibility, or is this a bug?

推荐答案

我也遇到了这个问题。在Apples开发者论坛上搜索后,我找到了这个帖子:
https://devforums.apple .com / thread / 235803?start = 0& tstart = 0

I ran into this problem too. After searching on Apples developer forum I found this thread: https://devforums.apple.com/thread/235803?start=0&tstart=0

显然,SearchBar也不会自动执行sizeToFit。所以它的高度保持在44而不是调整到范围按钮。
这个bug在iOS8 GM中没有修复。

And apparently the SearchBar don't automatically does a sizeToFit when it's supposed too. So it's height stays at 44 instead of adjusting to the scope buttons. The bug is not fixed in the iOS8 GM.

我在viewWillAppear中做了一个简单的[self.searchBar sizeToFit]:这解决了它。

I did a simple [self.searchBar sizeToFit] in my viewWillAppear: and that solved it.

这篇关于showsScopeBar = YES时,iOS8上的UISearchBar高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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