PYSearch
PYSearch copied to clipboard
searchSuggestionVC的frame问题
1.如果用自己的navController时候,你设置searchSuggestionVC的y为64,会导致界面向下偏移64。这问题让我找了好久,我还以为是自己写的导航栏有问题。 2.PYSearchSuggestionViewController的Cell 允许自定义就好了。 3.点击PYSearchSuggestionViewController的cell,可以把回调公开出去。 这是本人一点小建议,希望作者考虑一下哈
@GL-ZHU 首先谢谢你的反馈。
-
searchSuggestionVC的y值为64是我内部的处理。
-
关于自定义搜索建议 可以通过设置searchViewController的dataScource实现,如下
@protocol PYSearchSuggestionViewDataSource <NSObject, UITableViewDataSource>
@required
/** 返回用户自定义搜索建议Cell */
- (UITableViewCell *)searchSuggestionView:(UITableView *)searchSuggestionView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
/** 返回用户自定义搜索建议cell的rows */
- (NSInteger)searchSuggestionView:(UITableView *)searchSuggestionView numberOfRowsInSection:(NSInteger)section;
@optional
/** 返回用户自定义搜索建议cell的section */
- (NSInteger)numberOfSectionsInSearchSuggestionView:(UITableView *)searchSuggestionView;
/** 返回用户自定义搜索建议cell高度 */
- (CGFloat)searchSuggestionView:(UITableView *)searchSuggestionView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
@end
- 关于点击PYSearchSuggestionViewController的cell的问题,我知道大部分的需求可能是获得相关模型,这个完全可以通过获取的
index得到 如下,如果你有特殊的需求,还望告知。
/** 点击搜索建议时调用,如果实现该代理方法则点击搜索建议时searchViewController:didSearchWithsearchBar:searchText:失效 */
- (void)searchViewController:(PYSearchViewController *)searchViewController didSelectSearchSuggestionAtIndex:(NSInteger)index searchText:(NSString *)searchText
谢谢你。关于自定义cell的问题,是因为我pod下来的代码是旧版本,没有这些dataScource。
@GL-ZHU 可以先更新本地仓库。 最新版本参照README.md里面的显示,目前最新是0.7.5!
这个我也遇到了,但是不知道怎么解决啊,就是热门搜索往上弹了64