gpt4 book ai didi

ios8 - 搜索 iOS 8 + XCode 6 后不显示标题 View

转载 作者:行者123 更新时间:2023-12-04 19:05:38 24 4
gpt4 key购买 nike

我有适用于 iOS7 及以下版本的工作应用程序
我使用 UISearchDisplayController 在表中进行搜索。

问题:
在 iOS8 中不显示搜索标题 View 后。
如下图所示。

搜索前:
enter image description here

搜索后:
enter image description here

我尝试使用 UISearchController 但也有同样的问题
我用了这个代码link

我在 TPSMastreViewController.m 中添加以下代码

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *v = [[UIView alloc] init];
v.backgroundColor = [UIColor greenColor];
return v;
}

我检查了那个委托(delegate) - (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section
在 iOS8 的情况下不调用。
编辑:
我的理解是只有 UITableViewDataSource 委托(delegate)被调用, UITableViewDelegate 没有。请不要说我在 ViewDidLoad 中设置了两个委托(delegate)

问题:
1] 是 UI 变化吗?
2]任何人都有补丁,以便委托(delegate)方法将强制调用。

最佳答案

我找到了答案,所以写在这里可能会帮助其他面临同样问题的人

只需要添加委托(delegate) heightForHeaderInSection,它将显示 UISearchController(iOS8) 的 searchResultsController 和 UISearchDisplayController(iOS7) 的 searchResultsTableView 的标题 View

在 TPSMastreViewController.m 中添加以下代码,它将解决问题。

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20;
}

我通过阅读这个问题找到了答案:)
in iOS 8 UITableView heightForHeaderInSection is not optional

关于ios8 - 搜索 iOS 8 + XCode 6 后不显示标题 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25647059/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com