我正在尝试使用scopeButtonTitles为我的IOS应用程序提供过滤/分类功能。我可以列出我的所有类别,但由于它们出现在一行上,因此无法完全查看所有类别,因此每个类别都被截断。如何在多行上显示类别,使其清晰可读?
目前,我们有searchController.searchBar.scopeButtonTitles = [ARRAY OF CATEGORIES]。 所有类别都出现在一行上,我希望它们出现在2行或3行上。
var categories = [" All"," Clothing"," Transportation"," Electronics", " Home Goods"," Books&学校用品","免费","其他"]
searchController.searchBar.delegate = self
searchController.searchBar.scopeButtonTitles = categories
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = true
definesPresentationContext = true
self.collectionView?.addSubview(searchController.searchBar)