- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在 iOS9 中遇到了这种奇怪的行为,当 ViewController 第一次出现时,范围栏就在 UISearchBar 后面可见:
按下“搜索”后,UISearchBar 的行为符合预期(UISearchBar 移至顶部,范围栏位于下方)。完成搜索或点击取消后,它会返回到我希望从头开始的状态:
在 viewDidLoad 方法中,我按如下方式初始化 UISearchController:
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
self.searchController.searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
[self.searchController.searchBar sizeToFit];
self.definesPresentationContext = YES;
self.tableView.tableHeaderView = self.searchController.searchBar;
self.searchController.searchBar.delegate = self;
self.searchController.searchBar.scopeButtonTitles = @[[self titleForScopeButton:ScopeButtonIdNameDesc],
[self titleForScopeButton:ScopeButtonIP]];
有什么想法吗?
最佳答案
我没有在那个应用程序上工作过一点,忘记了我在 appDelegate 的 didFinishLaunchingWithOptions 中设置了 UISearchBar 的整体外观。
[[UISearchBar appearance] setSearchBarStyle:UISearchBarStyleMinimal];
[[UISearchBar appearance] setBackgroundColor:[PCConstantsGUI tintColor]];
[[UISearchBar appearance] setTintColor:[PCConstantsGUI tintColor]];
导致渲染问题的罪魁祸首是“UISearchBarStyleMinimal”,在我不得不用 UISearchController 替换已弃用的 UISearchDisplayController 之前它看起来很漂亮。
关于ios - UISearchBar 后面可见的范围栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34499913/
这个问题本质上是,UISearchBar在激活时与状态栏重叠。我知道已经有很多类似的问题发布了,我已经尝试了所有方法,但仍然无法解决。 当屏幕初始化时,搜索栏似乎位于正确的位置。当我向下滚动屏幕时,您
我尝试在我的应用程序中实现 iOS 11 中的新搜索栏,但出于某种原因,我无法让搜索栏颜色随导航栏一起更改。在切换到新样式之前,我在 AppDelagate 中使用 UISearchBar.appea
我正在努力做到这一点: Consider a table view with Search Bar on its header.Table view gets refreshed whenever s
documentation表示 UISearchBar我们可以在 tvOS 中使用它(Apple 当然在他们的搜索 View 中使用它),但我在对象库中找不到它。 其他人有同样的问题吗?我没有看到一个
当我在 UISearchBar 上搜索时,我的普通 tableView 已设置为 - (UITableViewCell *)tableView:(UITableView *)tableView cel
这里是我在view controller.h中的代码 #import "AppDelegate.h" @interface SearchRsultsFanSideViewController : UI
我在一个应用程序工作,我今天在 iOS 7.1 上进行了测试。到目前为止,我的搜索栏是正常的: 但现在我有这个问题: 出现一个灰色 View ,我不知道如何删除它,因为我的代码中没有这个 View 。
我正在更新适用于 iOS 7 的应用程序,而我的一项功能(允许在搜索栏中没有文本的情况下激活搜索栏搜索按钮)停止工作。我使用了以下代码。关于如何让它再次工作有什么建议吗?提前致谢。 UITextFie
我有一个带有 UISearchBar(和 SearchDisplayController)的 UIViewController 以及一个 UITableView。当导航到这个 View Control
我有一个我似乎无法克服的小情况。 我有一个 UITableView,它的顶部嵌入了一个 UISearchBar。 TableView 由 NSFetchedResultsController 和 Co
我在 TableView 顶部使用带有 UISearchBar 的 UITableView,对我来说,一切都工作正常,只有一个问题,比如如果我搜索一个字母,uitableview 中的搜索结果被过滤,
表格标题中有一个搜索栏。当用户在 iOS 7 上快速点击它两次时,它就会消失。有人对我们做错了什么有什么建议吗? 最佳答案 经过大量的试验和错误,我发现当searchDisplayController
我想更改 UISearchBar。文本字段的高度和宽度。我的问题是如何更改 iphone 中 UISearchBar 中的 UiSearchbar 高度、宽度、颜色 和 Uitextfield 高度?
这两张图应该可以说明了吧。第一个正常显示我的 UITableView。第二个显示当我触摸 UISearchBar 并且它获得焦点时。为什么单元格标题和搜索栏之间有间隙?有人知道如何解决这个问题吗? i
我有一个 UISearchBar添加到 UITableView 的顶部. // init search bar self.resultSearchController = ({
在 iOS 5 上使用带有 showCancelButton=YES 的 UISearchBar。希望在键盘下拉时取消按钮保持启用状态。使用以下代码似乎不起作用: for (id subView in
我有一个 UITableView,它的数据源和委托(delegate)不是由放置它的 View Controller 处理的,而是由另一个名为 AbstractInviteFriendsDataSou
我研究过这个问题。看起来这是一个常见问题,但我尝试过的任何方法都没有奏效。我对 iPhone 应用程序开发和 objective-c 非常陌生。此时我想做的就是在搜索栏字段中输入一个字符串,并在点击键
我有一个使用 UISearchBar 的搜索功能,该功能是即时发生的,所以我认为用“完成”替换键盘上的“搜索”按钮会更明显。 有办法做到这一点吗? 谢谢 最佳答案 您可以更改 UISearchBar
有没有人设法为 UISearchBar 的范围栏部分着色,它有一个 tintColor 属性,但设置它不会影响附加的范围栏 UISegmentedControl。我在酒吧上有一个 Handlebars
我是一名优秀的程序员,十分优秀!