gpt4 book ai didi

ios - iOS 8 中弃用的 searchDisplayController

转载 作者:IT王子 更新时间:2023-10-29 07:55:47 24 4
gpt4 key购买 nike

如何更正以下内容以免出现警告?我错过了什么?

当将 searchResultsController 更正为 searchController 时,出现错误“找不到对象”

if (tableView == self.searchDisplayController.searchResultsTableView) {
cell.textLabel.text = [searchResults objectAtIndex:indexPath.row];
} else {
cell.textLabel.text = [_content objectAtIndex:indexPath.row];
}

return cell;
}

-(BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
return YES;
}

最佳答案

The UISearchController class replaces the UISearchDisplayController class for managing the display of search-related interfaces.

来源:https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html

因此,正如 rmaddy 所说,如果您想摆脱弃用的警告,请停止使用弃用的类。使用 UISearchController 代替:

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UISearchController/index.html#//apple_ref/occ/cl/UISearchController

关于ios - iOS 8 中弃用的 searchDisplayController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25826332/

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