综合(QQ 音乐、微信、美团、优酷、虎牙直播等多款 app)风格的搜索控制器。
huhepei
9年前
<h2><strong>PYSearch</strong></h2> <ul> <li> <p>:mag: An elegant search controller for iOS.</p> </li> <li> <p>:mag: iOS 中一款优雅的搜索控制器。</p> </li> </ul> <h2><strong>Features</strong></h2> <ul> <li> <p>支持多种热门搜索风格</p> </li> <li> <p>支持多种搜索历史风格</p> </li> <li> <p>支持搜索建议</p> </li> <li> <p>支持搜索历史(记录)缓存</p> </li> <li> <p>支持使用delegate 或者 block 完成搜索时的回调</p> </li> <li> <p>支持CocoaPods</p> </li> </ul> <h2><strong>Requirements</strong></h2> <ul> <li>iOS 7.0 or later</li> <li>Xcode 8.0 or later</li> </ul> <h2><strong>Contents</strong></h2> <ul> <li> <p>Getting Started</p> <ul> <li>Renderings【效果图】</li> <li>Styles 【支持哪些风格】</li> </ul> </li> <li> <p>Usage</p> <ul> <li>How to use【如何使用PYSearch】</li> <li>Details 【具体使用(详情见示例程序PYSearchExample)】</li> <li>Custom【自定义PYSearch】</li> </ul> </li> <li> <p>期待</p> </li> </ul> <h2><strong>效果图</strong></h2> <p style="text-align:center"><img src="https://simg.open-open.com/show/c9a9adb25f1d252ed00337ba4f00700f.gif"></p> <h2><strong>支持哪些风格</strong></h2> <p>热门搜索风格</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/03ee3208f82cb55b024359db167c1dee.png"> <img src="https://simg.open-open.com/show/72dd5674d7be88ab2cc827a3c33cb175.png"></p> <p style="text-align: center;"><img src="https://simg.open-open.com/show/1db63bba47026d07e2049339311ca7e8.png"> <img src="https://simg.open-open.com/show/1b9578f8902cd6cd95d9b157380787b0.png"></p> <p style="text-align:center"><img src="https://simg.open-open.com/show/5dd35d6f4931153e682c2ac960b37a90.png"> <img src="https://simg.open-open.com/show/3666f6504cec0a9a36a11c56f80842e7.png"></p> <p>搜索历史风格</p> <p style="text-align:center"><img src="https://simg.open-open.com/show/b476680fd1a2160c11f58e45a9d9fa46.png"> <img src="https://simg.open-open.com/show/5f00f59fc11e8abf9042960ab2692805.png"></p> <p style="text-align:center"><img src="https://simg.open-open.com/show/4bc50a13b58ec21a06e126e1b323284f.png"> <img src="https://simg.open-open.com/show/71027d34666672cde5e2167f3472e43e.png"></p> <p style="text-align:center"><img src="https://simg.open-open.com/show/eee5b30f362cd8e60d0622799dfc0170.png"></p> <h2><strong>如何使用PYSearch</strong></h2> <ul> <li> <p>使用CocoaPods:</p> <ul> <li>pod "PYSearch"</li> <li>导入主头文件 #import <PYSearch.h></li> </ul> </li> <li> <p>手动导入:</p> <ul> <li>将 PYSearch 文件夹中的所有文件拽入项目中</li> <li>导入主头文件 #import "PYSearch.h"</li> </ul> </li> </ul> <h2><strong>具体使用(详情见示例程序PYSearchExample)</strong></h2> <pre> <code class="language-objectivec">// 1. 创建热门搜索数组 NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"]; // 2. 创建搜索控制器 PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"搜索编程语言" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) { // 开始(点击)搜索时执行以下代码 // 如:跳转到指定控制器 [searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES]; }]; // 3. 跳转到搜索控制器 UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController]; [self presentViewController:nav animated:NO completion:nil];</code></pre> <h2><strong>自定义PYSearch</strong></h2> <h3><strong>通过设置searchViewContoller的对象属性值即可修改</strong></h3> <ul> <li> <p>设置热门搜索风格(默认为PYHotSearchStyleNormalTag)</p> </li> </ul> <pre> <code class="language-objectivec">// 设置热门搜索为彩色标签风格 searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;</code></pre> <ul> <li> <p>设置搜索历史风格(默认为PYSearchHistoryStyleCell)</p> </li> </ul> <pre> <code class="language-objectivec">// 设置搜索历史为带边框标签风格 searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;</code></pre> <ul> <li> <p>隐藏搜索建议(默认为:NO)</p> </li> </ul> <pre> <code class="language-objectivec">// 隐藏搜索建议 searchViewController.searchSuggestionHidden = YES;</code></pre> <h2><strong>期待</strong></h2> <ul> <li> <p>如果您在使用过程中有任何问题,欢迎issue me! 很乐意为您解答任何相关问题!</p> </li> <li> <p>与其给我点star,不如向我狠狠地抛来一个BUG!</p> </li> <li> <p>如果想要参与这个项目的维护或者有好的设计风格,欢迎pull request!</p> </li> <li> <p>如果您想要更多的接口来自定义或者建议/意见,欢迎issue me!我会根据大家的需求提供更多的接口!</p> </li> </ul> <h2><strong>Licenses</strong></h2> <p>All source code is licensed under the MIT License.</p> <p> </p> <p> </p> <p> </p>