# PYSearch
[](https://travis-ci.org/iphone5solo/PYSearch)
[](http://cocoadocs.org/docsets/PYSearch/)
[](http://cocoadocs.org/docsets/PYSearch/)
[](https://opensource.org/licenses/MIT)
- 🔍 An elegant search controller for iOS.
## QQ chat room
## Features
- [x] Support a variety of hot search style
- [x] Support a variety of search history style
- [x] Support a variety of search results display mode
- [x] Support search suggestions
- [x] Support search history (record) cache
- [x] Support callback using delegate or block completion search
- [x] Support CocoaPods
- [x] Support localization
- [x] Support vertical and horizontal screen on iPhone and iPad
## Requirements
* iOS 7.0 or later
* Xcode 7.0 or later
## Architecture
### Main
- `PYSearch`
- `PYSearchConst`
- `PYSearchViewController`
- `PYSearchSuggestionViewController`
### Category
- `UIColor+PYSearchExtension`
- `UIView+PYSearchExtension`
- `NSBundle+PYSearchExtension`
## Contents
* Getting Started
* [Renderings](#Renderings)
* [Styles](#Styles)
* Usage
* [How to use](#Howtouse)
* [Details (See the example program PYSearchExample for details)](#Details)
* [Custom](#Custom)
* [Hope](#Hope)
## Renderings
## Styles
#### Hot search style


#### Search history style


## How to use
* Use CocoaPods:
- `pod "PYSearch"`
- Import the main file:`#import `
* Manual import:
- Drag All files in the `PYSearch` folder to project
- Import the main file:`#import "PYSearch.h"`
## Details (See the example program PYSearchExample for details)
```objc
// 1. Create hotSearches array
NSArray *hotSeaches = @[@"Java", @"Python", @"Objective-C", @"Swift", @"C", @"C++", @"PHP", @"C#", @"Perl", @"Go", @"JavaScript", @"R", @"Ruby", @"MATLAB"];
// 2. Create searchViewController
PYSearchViewController *searchViewController = [PYSearchViewController searchViewControllerWithHotSearches:hotSeaches searchBarPlaceholder:@"Search programming language" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
// Call this Block when completion search automatically
// Such as: Push to a view controller
[searchViewController.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
}];
// 3. present the searchViewController
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:searchViewController];
[self presentViewController:nav animated:NO completion:nil];
```
## Custom
* Custom search suggestions display
```objc
// 1. Set dataSource
searchViewController.dataSource = self;
// 2. Implement dataSource method
```
* Custom search result dispaly
```objc
// 1. Set searchResultShowMode
searchViewController.searchResultShowMode = PYSearchResultShowModeEmbed;
// 2. Set searchResultController
searchViewController.searchResultController = [[UIViewController alloc] init];
```
* Set hotSearchStyle(default is PYHotSearchStyleNormalTag)
```objc
// Set hotSearchStyle
searchViewController.hotSearchStyle = PYHotSearchStyleColorfulTag;
```
* Set searchHistoryStyle(default is PYS