gpt4 book ai didi

ios - UISearchDisplayController 在 IOS8.0 中被弃用,那么如何初始化它呢?

转载 作者:行者123 更新时间:2023-11-28 21:53:49 25 4
gpt4 key购买 nike

UISearchDisplayControllerIOS8.0 中被弃用,推荐使用 UISearchController 代替。

然后如何使用新的**API**来实现流式传输:

(来自初识IOS7开发探索IOS SDK)

UISearchBar *searchBar = [[UISearchBar alloc]
initWithFrame:CGRectMake(0, 0, 320, 44)];
tableView.tableHeaderView = searchBar;
searchContoller = [[UISearchDisplayController alloc]
initWithSearchBar:searchBar
contentsController:self];
searchController.delegate = self;
searchController.searchResultsDataSource = self;

你知道UISearchController中的API不一样,那怎么办?

最佳答案

来自 APPLE DOCUMENTATION :

searchController = [[UISearchController alloc] initWithSearchResultsController:nil];

searchController.searchResultsUpdater = self;

searchController.dimsBackgroundDuringPresentation = NO;

searchController.hidesNavigationBarDuringPresentation = NO;

searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44.0);

self.tableView.tableHeaderView = self.searchController.searchBar;

检查这个SAMPLE PROJECT在 UISearchController 上。

关于ios - UISearchDisplayController 在 IOS8.0 中被弃用,那么如何初始化它呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27309993/

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