GitHub 地址:https://github.com/iphone5solo/PYSearch
PYSearch
PYSearchConst
PYSearchViewController
PYSearchSuggestionViewController
UIColor+PYExtension
UIView+PYExtension
pod "PYSearch"
#import <PYSearch.h>
PYSearch
文件夹中的所有文件拽入项目中#import "PYSearch.h"
// 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.searchResultController.title = @"PYSearchResultController";
}];
// 3. 跳转到搜索控制器
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:NO completion:nil];
// 设置热门搜索为彩色标签风格
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
// 设置搜索历史为带边框标签风格
searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
// 设置搜索模式为内嵌
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
// 隐藏搜索建议
searchViewController.searchSuggestionHidden = YES;
All source code is licensed under the MIT License.
1
mzh 2016-10-31 14:05:56 +08:00 via iPhone
很全面…
|
2
itqls 2016-10-31 14:49:43 +08:00
mark
|
3
chenyg32 2016-11-07 15:37:16 +08:00
不错不错 赞一个。命名也不错, PY
|