UISearchBar的范围按钮不会显示iOS6 [英] UISearchBar's scope button won't show up iOS6

查看:125
本文介绍了UISearchBar的范围按钮不会显示iOS6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道之前曾多次询问过这个问题,并且已经解决了(在我使用iOS4和5的解决方案之前)。我最近的项目涉及使用 UISearchBar 和其他一些视图,我想在它变为活动状态时显示它的范围按钮。之前,在 UISearchBardelegate - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar 我在做什么

I know this question was asked several times before, and it was solved(Before I was using that solution with iOS4 and 5). My recent project involves using UISearchBar with some other views, and I want to show it's scope buttons when it becomes active. Before, in UISearchBardelegate's - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar I was doing

[searchBar setShowsScopeBar:YES];
[searchBar sizeToFit];

并显示范围按钮。但是现在,在iOS6上,这段代码什么也没做。在IB中添加了 UISearchBar ,它的委托被设置为我的视图控制器。
有人解决这个问题吗?在此先感谢。

and it was showing scope buttons. But now, on iOS6 this code does nothing. UISearchBar is added in IB, it's delegate is set to my view controller. Anybody has solution for this problem? Thanks in advance.

推荐答案

好吧,问题出在iOS 6自动布局的事情上,一旦我把它删除了,问题就消失了。谢谢大家:))

Ok, problem was with iOS 6 auto layout thing, once I'va removed it, problem was gone. Thanks everyone :)

这篇关于UISearchBar的范围按钮不会显示iOS6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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