搜索交互控件的简单封装,代码比较简单,没有做太多注释,希望对你有帮助,如果你有好的欢迎你给我交流,谢谢
running2snail / llsearchview Goto Github PK
View Code? Open in Web Editor NEW搜索交互控件的简单封装
搜索交互控件的简单封装
第一进行搜索的时候,跳转到LLSearchResultViewController加载出搜索的关键字商品。但是在LLSearchResultViewController这个控制器里面点击搜索栏的X号。重新回到LLSearchViewController控制器,在点击最近搜索或者热门搜索时,跳转到LLSearchResultViewController,但是此时数据重新加载。请问这种问题怎么解决?
LLSearchViewController中的如下方法是不需要的
/** 点击取消 */
(void)cancelDidClick
{
[self.searchBar resignFirstResponder];
[self dismissViewControllerAnimated:NO completion:nil];
}
还有个bug当在搜索结果页面点击输入框中的x然后再点击右上角的取消按钮时候不能回退而且页面又会变成搜索结果页面了,已经进行了修复,
LLSearchResultViewController里面
(void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
[self.searchBar resignFirstResponder];
_titleView.frame = CGRectMake(0, 7, self.view.frame.size.width - 44 * 2 - 16, 30);
_searchBar.frame = CGRectMake(0, 0, CGRectGetWidth(_titleView.frame), 30);
searchBar.showsCancelButton = NO;
_activity = NO;
_searchSuggestVC.view.hidden = YES;
[self presentVCFirstBackClick:nil];
}
加上了presentVc那句
然后当回退的时候下面的resultView会闪现,
解决办法是
(void)presentVCFirstBackClick:(UIButton *)sender
{
[_searchBar resignFirstResponder];
//在pop出去的时候移除resultview,不然会有一瞬间的闪现
[_resultView removeFromSuperview];
[self.navigationController popToRootViewControllerAnimated:YES];
}
回退前移除,以上是我进行修改过的地方,暂时发现这两个问题
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.