gpt4 book ai didi

objective-c - iphone 隐藏 UISearchDisplayController 结果?

转载 作者:搜寻专家 更新时间:2023-10-30 19:51:51 24 4
gpt4 key购买 nike

我目前有一个 UISearchBar 和 UISearchDisplayController 实现为:

- (void) viewDidLoad {

videoList = [[NSMutableArray alloc]init];

//Add the search bar
aSearchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
[aSearchBar sizeToFit];
aSearchBar.delegate = self;
aSearchBar.placeholder = @"Search YouTube...";

self.tableView.tableHeaderView = aSearchBar;

searchDC = [[UISearchDisplayController alloc] initWithSearchBar:aSearchBar contentsController:self];

[self performSelector:@selector(setSearchDisplayController:) withObject:searchDC];

searchDC.delegate = self;
searchDC.searchResultsDataSource = self.tableView.dataSource;
searchDC.searchResultsDelegate = self.tableView.delegate;

[aSearchBar release];
[searchDC release];

}

当用户键入内容并点击搜索时,tableView 会出现在后台 tableView 的顶部。

有没有办法隐藏这个“searchResults tableView”? (我只想让背景表保存数据……它当前保存的数据)。

即有属性(property)吗?例如searchDisplayController.tableView.visible=否或类似?

最佳答案

但这并没有关闭搜索界面(搜索栏和“取消”按钮)。下一个代码就是这样做的:

    [self.searchDisplayController setActive:NO animated:YES];

关于objective-c - iphone 隐藏 UISearchDisplayController 结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3648668/

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