Getting Started
Usage
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.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
}];
// 3. 跳转到搜索控制器
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:NO completion:nil];
// 设置热门搜索为彩色标签风格
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
// 设置搜索历史为带边框标签风格
searchViewController.searchHistoryStyle = PYSearchHistoryStyleBorderTag;
// 隐藏搜索建议
searchViewController.searchSuggestionHidden = YES;
All source code is licensed under the MIT License.
1
cyanbox 2016-10-26 14:02:49 +08:00
赞!不过 py ?
|
2
programdog 2016-10-26 17:39:20 +08:00
66666
|