PYSearch icon indicating copy to clipboard operation
PYSearch copied to clipboard

searchSuggestionVC的frame问题

Open coder-glzhu opened this issue 8 years ago • 4 comments

1.如果用自己的navController时候,你设置searchSuggestionVC的y为64,会导致界面向下偏移64。这问题让我找了好久,我还以为是自己写的导航栏有问题。 2.PYSearchSuggestionViewController的Cell 允许自定义就好了。 3.点击PYSearchSuggestionViewController的cell,可以把回调公开出去。 这是本人一点小建议,希望作者考虑一下哈

coder-glzhu avatar Apr 06 '17 07:04 coder-glzhu

@GL-ZHU 首先谢谢你的反馈。

  1. searchSuggestionVC的y值为64是我内部的处理。

  2. 关于自定义搜索建议 可以通过设置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
  1. 关于点击PYSearchSuggestionViewController的cell的问题,我知道大部分的需求可能是获得相关模型,这个完全可以通过获取的index得到 如下,如果你有特殊的需求,还望告知。
/** 点击搜索建议时调用,如果实现该代理方法则点击搜索建议时searchViewController:didSearchWithsearchBar:searchText:失效 */
- (void)searchViewController:(PYSearchViewController *)searchViewController didSelectSearchSuggestionAtIndex:(NSInteger)index searchText:(NSString *)searchText 

ko1o avatar Apr 06 '17 08:04 ko1o

谢谢你。关于自定义cell的问题,是因为我pod下来的代码是旧版本,没有这些dataScource。

coder-glzhu avatar Apr 06 '17 08:04 coder-glzhu

@GL-ZHU 可以先更新本地仓库。 最新版本参照README.md里面的显示,目前最新是0.7.5!

ko1o avatar Apr 06 '17 08:04 ko1o

这个我也遇到了,但是不知道怎么解决啊,就是热门搜索往上弹了64

zhaomengshan avatar Apr 25 '18 07:04 zhaomengshan