Closed Vinceless closed 5 years ago
@Sugarless 可以通过以下代理自定义
protocol PYSearchViewControllerDataSource <NSObject>
@optional
/**
Return a `UITableViewCell` object.
@param searchSuggestionView view which display search suggestions
@param indexPath indexPath of row
@return a `UITableViewCell` object
*/
- (UITableViewCell *)searchSuggestionView:(UITableView *)searchSuggestionView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
/**
Return number of rows in section.
@param searchSuggestionView view which display search suggestions
@param section index of section
@return number of rows in section
*/
- (NSInteger)searchSuggestionView:(UITableView *)searchSuggestionView numberOfRowsInSection:(NSInteger)section;
/**
Return number of sections in search suggestion view.
@param searchSuggestionView view which display search suggestions
@return number of sections
*/
- (NSInteger)numberOfSectionsInSearchSuggestionView:(UITableView *)searchSuggestionView;
/**
Return height for row.
@param searchSuggestionView view which display search suggestions
@param indexPath indexPath of row
@return height of row
*/
- (CGFloat)searchSuggestionView:(UITableView *)searchSuggestionView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
@end
😂不是这个问题,因为我用的是massonry,所以要修改searchSuggestionView的属性,一直修改不成功,所以才去PYSearchSuggestionViewController,我现在解决了,我在PYSearchViewController.m里的setup里面加了句_searchSuggestionView = (UITableView *)self.searchSuggestionVC.tableView; 就可以了,因为一开始初始化,searchSuggestionView是nil
😄一开始用的就是这个代理,现在解决了,谢谢大佬
搜索结果显示那一块抽象成可修改的么=。=,现在要改搜索结果显示,只能改PYSearchSuggestionViewController,有多个不同的搜索的页面时候,就有点麻烦了